[OpenLayers-Commits] r11380 - sandbox/camptocamp/mobile/openlayers/examples

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Thu Feb 24 04:00:12 EST 2011


Author: pgiraud
Date: 2011-02-24 01:00:12 -0800 (Thu, 24 Feb 2011)
New Revision: 11380

Modified:
   sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.html
   sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.js
   sandbox/camptocamp/mobile/openlayers/examples/mobile.js
Log:
First round for a layer switcher

Modified: sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.html
===================================================================
--- sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.html	2011-02-24 08:48:03 UTC (rev 11379)
+++ sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.html	2011-02-24 09:00:12 UTC (rev 11380)
@@ -11,6 +11,7 @@
         <script src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>
         <link rel="stylesheet" href="style.mobile.css" type="text/css">
         <script src="../build/OpenLayers.js"></script>
+        <script src="http://maps.google.com/maps/api/js?v=3.3&amp;sensor=false"></script>
         <script src="mobile.js"></script>
         <script src="mobile-jq.js"></script>
         <style>
@@ -97,6 +98,9 @@
             <div data-role="header">
                 <h1>Layers</h1>
             </div>
+            <div data-role="content">
+                <div data-role="controlgroup" id="layerslist"></div>
+            </div>
         </div>
     </body>
 </html>

Modified: sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.js
===================================================================
--- sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.js	2011-02-24 08:48:03 UTC (rev 11379)
+++ sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.js	2011-02-24 09:00:12 UTC (rev 11380)
@@ -79,4 +79,16 @@
         // only listen to the first event triggered
         $('#searchpage').die('pageshow', arguments.callee);
     });
+
+    $.each(map.layers, function() {
+        $('<a />', {
+            text: this.name,
+            href: "",
+            "data-role": "button"
+        })
+            .appendTo('#layerslist')
+            .click(function() {
+                $(this).find('.ui-icon-check').toggleClass('ui-icon');
+            });
+    });
 });

Modified: sandbox/camptocamp/mobile/openlayers/examples/mobile.js
===================================================================
--- sandbox/camptocamp/mobile/openlayers/examples/mobile.js	2011-02-24 08:48:03 UTC (rev 11379)
+++ sandbox/camptocamp/mobile/openlayers/examples/mobile.js	2011-02-24 09:00:12 UTC (rev 11380)
@@ -6,7 +6,7 @@
 function init() {
     
     // layer for drawn features
-    var vector = new OpenLayers.Layer.Vector();
+    var vector = new OpenLayers.Layer.Vector('Vector Layer');
 
     var geolocate = new OpenLayers.Control.Geolocate({
         id: "locate-control",
@@ -44,7 +44,26 @@
             new OpenLayers.Control.ModifyFeature(vector, {id: "mod-control"}),
             geolocate
         ],
-        layers: [new OpenLayers.Layer.OSM(), vector],
+        layers: [
+            new OpenLayers.Layer.OSM(),
+            new OpenLayers.Layer.Google(
+                "Google Physical",
+                {type: google.maps.MapTypeId.TERRAIN}
+            ),
+            new OpenLayers.Layer.Google(
+                "Google Streets", // the default
+                {numZoomLevels: 20}
+            ),
+            new OpenLayers.Layer.Google(
+                "Google Hybrid",
+                {type: google.maps.MapTypeId.HYBRID, numZoomLevels: 20}
+            ),
+            new OpenLayers.Layer.Google(
+                "Google Satellite",
+                {type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22}
+            ),
+            vector
+        ],
         center: new OpenLayers.LonLat(0, 0),
         zoom: 1
     });



More information about the Commits mailing list