[OpenLayers-Commits] r4245 - trunk/openlayers/examples

commits at openlayers.org commits at openlayers.org
Wed Sep 12 14:30:03 EDT 2007


Author: crschmidt
Date: 2007-09-12 14:30:01 -0400 (Wed, 12 Sep 2007)
New Revision: 4245

Added:
   trunk/openlayers/examples/custom-control-point.html
Log:
Add custom-control-point demo showing use of point handler to return data. 


Added: trunk/openlayers/examples/custom-control-point.html
===================================================================
--- trunk/openlayers/examples/custom-control-point.html	                        (rev 0)
+++ trunk/openlayers/examples/custom-control-point.html	2007-09-12 18:30:01 UTC (rev 4245)
@@ -0,0 +1,51 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <style type="text/css">
+        #map {
+            width: 800px;
+            height: 475px;
+            border: 1px solid black;
+        }
+    </style>
+    <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') );
+
+            layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
+                    "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
+
+            var control = new OpenLayers.Control();
+            OpenLayers.Util.extend(control, {
+                draw: function () {
+                    // this Handler.Point will intercept the shift-mousedown
+                    // before Control.MouseDefault gets to see it
+                    this.point = new OpenLayers.Handler.Point( control,
+                        {"done": this.notice},
+                        {keyMask: OpenLayers.Handler.MOD_SHIFT});
+                    this.point.activate();
+                },
+
+                notice: function (bounds) {
+                    document.getElementById('bounds').innerHTML = bounds;
+                }
+            });
+
+            map.addLayer(layer);
+            map.addControl(control);
+            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
+        }
+        // -->
+    </script>
+  </head>
+  <body onload="init()">
+    <div id="map"></div>
+    <div id="bounds"></div>
+  </body>
+</html>



More information about the Commits mailing list