summaryrefslogtreecommitdiff
path: root/misc/openlayers/examples/animated_panning.html
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
committerChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
commitea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch)
treeaf67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/examples/animated_panning.html
parent59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff)
downloadpostrunner-ea346a785dc1b3f7c156f6fc33da634e1f1a627b.zip
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/examples/animated_panning.html')
-rw-r--r--misc/openlayers/examples/animated_panning.html98
1 files changed, 98 insertions, 0 deletions
diff --git a/misc/openlayers/examples/animated_panning.html b/misc/openlayers/examples/animated_panning.html
new file mode 100644
index 0000000..a07017c
--- /dev/null
+++ b/misc/openlayers/examples/animated_panning.html
@@ -0,0 +1,98 @@
+<!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>Animated Panning of the Map via map.panTo</title>
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="style.css" type="text/css">
+ <script src="../lib/OpenLayers.js"></script>
+ <script type="text/javascript">
+ var map, layer, running = false;
+
+ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
+ defaultHandlerOptions: {
+ 'single': true,
+ 'delay': 200
+ },
+
+ initialize: function(options) {
+ this.handlerOptions = OpenLayers.Util.extend(
+ {}, this.defaultHandlerOptions
+ );
+ OpenLayers.Control.prototype.initialize.apply(
+ this, arguments
+ );
+ this.handler = new OpenLayers.Handler.Click(
+ this, {
+ 'click': this.onClick
+ }, this.handlerOptions
+ );
+ },
+
+ onClick: function(evt) {
+ map.panTo(map.getLonLatFromPixel(evt.xy));
+ }
+
+ });
+
+ function init(){
+ map = new OpenLayers.Map('map', {numZoomLevels: 2});
+ layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
+ "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} );
+
+ map.addLayer(layer);
+ map.zoomToMaxExtent();
+ var click = new OpenLayers.Control.Click();
+ map.addControl(click);
+ click.activate();
+ map.addControl(new OpenLayers.Control.OverviewMap());
+
+ map2 = new OpenLayers.Map('map2', {'panMethod': null, numZoomLevels: 2} );
+ layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
+ "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} );
+
+ map2.addLayer(layer);
+ map2.zoomToMaxExtent();
+ }
+
+ function setCenterInterval() {
+ if (!running) {
+ setCenter();
+ running = setInterval('setCenter()', 500);
+ } else {
+ clearInterval(running);
+ running = false;
+ }
+ }
+
+ function setCenter() {
+ var lon = Math.random() * 360 - 180;
+ var lat = Math.random() * 180 - 90;
+ var lonlat = new OpenLayers.LonLat(lon, lat);
+ map.panTo(lonlat);
+ }
+ </script>
+ </head>
+ <body onload="init()">
+ <h1 id="title">map.panTo Example</h1>
+ <div id="tags">
+ panning, animation, effect, smooth, panMethod
+ </div>
+ <div id="shortdesc">Show animated panning effects in the map</div>
+ <div id="map" class="smallmap"></div>
+ <div id="docs">
+ <p>This is an example of transition effects. If the new random center is in the current extent, the map will pan smoothly. <br>
+ The random selection will continue until you press it again. Additionally, you can single click in the map to pan smoothly
+ to that area, or use the pan control to pan smoothly.
+ </p>
+ </div>
+ <button onclick="setCenterInterval()">Start/stop random recenter</button>
+ <div id="map2" class="smallmap"></div>
+ <div>
+ <p>To turn off Animated Panning, create a map with an panMethod set to
+ null. </p>
+ </div>
+ </body>
+</html>