[OpenLayers-Commits] r12292 - sandbox/camptocamp/clientzoom/examples

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Wed Aug 31 04:23:36 EDT 2011


Author: cmoullet
Date: 2011-08-31 01:23:35 -0700 (Wed, 31 Aug 2011)
New Revision: 12292

Added:
   sandbox/camptocamp/clientzoom/examples/zoomclient.html
   sandbox/camptocamp/clientzoom/examples/zoomclient.js
Log:
Add a zoom client example


Added: sandbox/camptocamp/clientzoom/examples/zoomclient.html
===================================================================
--- sandbox/camptocamp/clientzoom/examples/zoomclient.html	                        (rev 0)
+++ sandbox/camptocamp/clientzoom/examples/zoomclient.html	2011-08-31 08:23:35 UTC (rev 12292)
@@ -0,0 +1,60 @@
+<!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>OpenLayers Zoom Client Example</title>
+        <link rel="stylesheet" href="../theme/default/style.css" type="text/css"/>
+        <link rel="stylesheet" href="style.css" type="text/css">
+        <script src="../lib/Firebug/firebug.js"></script>
+        <script src="../lib/OpenLayers.js"></script>
+        <script src="zoomclient.js"></script>
+        <style>
+            .olControlAttribution {
+                bottom: 5px;
+            }
+        </style>
+    </head>
+    <body onload="init();">
+        <h1 id="title">Zoom client</h1>
+        <div id="tags">
+            zoom client
+        </div>         
+        <p id="shortdesc">
+            The Zoom client allows the programmatic zoom of tiled layers (TMS, TileCache, WMS-C, WMTS and XYZ) if a 
+            map resolution is not present in the layer server resolution.
+        </p>
+        
+        <div id="map" class="smallmap"></div>
+
+        <div id="docs">
+            <p>
+                This example presents ths usage of the client zoom for the OSM layer.
+            </p>
+
+            <p>
+
+                This example demonstrates the <strong>"client zoom"</strong>
+                functionality.
+
+                The map works with 22 resolutions. But the OSM layer is
+                configured as its tile service supported only 19 of these
+                resolutions. The resolutions for the zoom levels 20,21 and 22 are
+                indeed not included in the OSM layer's
+                <code>serverResolutions</code> option.
+
+                The map's initial zoom is 18. So if you zoom in or out
+                you'll see that "client zoom" is applied
+
+            </p>
+
+            <p>
+
+                See the <a href="zoomclient.js" target="_blank">
+                zoomclient.js source</a> to see how this is done.
+
+            </p>
+        </div>
+    </body>
+</html>

Added: sandbox/camptocamp/clientzoom/examples/zoomclient.js
===================================================================
--- sandbox/camptocamp/clientzoom/examples/zoomclient.js	                        (rev 0)
+++ sandbox/camptocamp/clientzoom/examples/zoomclient.js	2011-08-31 08:23:35 UTC (rev 12292)
@@ -0,0 +1,22 @@
+var map;
+
+function init() {
+    
+    map = new OpenLayers.Map({
+        div: "map",
+        projection: "EPSG:900913",
+        units: "m",
+        maxExtent: new OpenLayers.Bounds(
+            -20037508.34, -20037508.34, 20037508.34, 20037508.34
+        )
+    });    
+    
+    var osm = new OpenLayers.Layer.OSM(null, null, {
+        resolutions: [156543.03390625, 78271.516953125, 39135.7584765625, 19567.87923828125, 9783.939619140625, 4891.9698095703125, 2445.9849047851562, 1222.9924523925781, 611.4962261962891, 305.74811309814453, 152.87405654907226, 76.43702827453613, 38.218514137268066, 19.109257068634033, 9.554628534317017, 4.777314267158508, 2.388657133579254, 1.194328566789627, 0.5971642833948135,0.25,0.1,0.05],
+        serverResolutions: [156543.03390625, 78271.516953125, 39135.7584765625, 19567.87923828125, 9783.939619140625, 4891.9698095703125, 2445.9849047851562, 1222.9924523925781, 611.4962261962891, 305.74811309814453, 152.87405654907226, 76.43702827453613, 38.218514137268066, 19.109257068634033, 9.554628534317017, 4.777314267158508, 2.388657133579254, 1.194328566789627, 0.5971642833948135]
+    });
+
+    map.addLayers([osm]);
+    map.addControl(new OpenLayers.Control.LayerSwitcher());
+    map.setCenter(new OpenLayers.LonLat(667250.8958124, 5668048.6072737), 18);
+}



More information about the Commits mailing list