[OpenLayers-Commits] r11587 - sandbox/crschmidt/ovi-mobile/examples

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Mon Feb 28 14:32:45 EST 2011


Author: crschmidt
Date: 2011-02-28 11:32:44 -0800 (Mon, 28 Feb 2011)
New Revision: 11587

Modified:
   sandbox/crschmidt/ovi-mobile/examples/ovi-base.js
   sandbox/crschmidt/ovi-mobile/examples/ovi-jq.html
   sandbox/crschmidt/ovi-mobile/examples/ovi-jq.js
Log:
More hacking.


Modified: sandbox/crschmidt/ovi-mobile/examples/ovi-base.js
===================================================================
--- sandbox/crschmidt/ovi-mobile/examples/ovi-base.js	2011-02-28 19:07:27 UTC (rev 11586)
+++ sandbox/crschmidt/ovi-mobile/examples/ovi-base.js	2011-02-28 19:32:44 UTC (rev 11587)
@@ -46,8 +46,8 @@
             }),
             vector
         ],
-        center: new OpenLayers.LonLat(0, 0),
-        zoom: 1
+        center: new OpenLayers.LonLat(0, 4000000),
+        zoom: 2
     });
 
     var style = {
@@ -56,6 +56,9 @@
         strokeColor: '#f00',
         strokeOpacity: 0.6
     };
+    geolocate.events.register("locationfailed",this,function(e) {
+        alert("Location update failed: " + e.error.message);
+    });    
     geolocate.events.register("locationupdated",this,function(e) {
         vector.removeAllFeatures();
         vector.addFeatures([

Modified: sandbox/crschmidt/ovi-mobile/examples/ovi-jq.html
===================================================================
--- sandbox/crschmidt/ovi-mobile/examples/ovi-jq.html	2011-02-28 19:07:27 UTC (rev 11586)
+++ sandbox/crschmidt/ovi-mobile/examples/ovi-jq.html	2011-02-28 19:32:44 UTC (rev 11587)
@@ -10,7 +10,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">
         <link rel="stylesheet" href="style.mobile-jq.css" type="text/css">
-        <script src="../lib/OpenLayers.js?mobile"></script>
+        <script src="../OpenLayers.js"></script>
         <script src="ovi-base.js"></script>
         <script src="ovi-jq.js"></script>
     </head>

Modified: sandbox/crschmidt/ovi-mobile/examples/ovi-jq.js
===================================================================
--- sandbox/crschmidt/ovi-mobile/examples/ovi-jq.js	2011-02-28 19:07:27 UTC (rev 11586)
+++ sandbox/crschmidt/ovi-mobile/examples/ovi-jq.js	2011-02-28 19:32:44 UTC (rev 11587)
@@ -49,7 +49,7 @@
         styleMap: new OpenLayers.StyleMap({
             'fillColor': 'red',
             'fillOpacity': .8,
-            'pointRadius': 5
+            'pointRadius': 10
         })});
     map.addLayer(searchLayer);
 /*    var sprintersLayer = new OpenLayers.Layer.Vector("Sprinters", {
@@ -77,9 +77,15 @@
     
     $('div#popup').live('pageshow',function(event, ui){
         var li = "";
-        for(var attr in selectedFeature.attributes){
-            li += "<li><div style='width:25%;float:left'>" + attr + "</div><div style='width:75%;float:right'>" 
-            + selectedFeature.attributes[attr] + "</div></li>";
+        var attrList = ['title', 'address', 'phoneNumber', 'url', 'placesId'];
+        for(var i = 0; i < attrList.length; i++){
+            if (selectedFeature.attributes[attrList[i]]) {
+                var key = attrList[i];
+                var value = selectedFeature.attributes[key];
+                
+                li += "<li><div style='width:25%;float:left'>" + key + "</div><div style='width:75%;float:right'>" 
+                    + value + "</div></li>";
+            }
         }
         $("ul#details-list").empty().append(li).listview("refresh");
     });
@@ -131,6 +137,7 @@
                             }
                         }
                         addr = addr.join(", "); 
+                        feature.attributes.address = addr;
 
                         $('<li>')
                             .hide()
@@ -143,7 +150,9 @@
                             .appendTo('#search_results')
                             .click(function() {
                                 $.mobile.changePage('mappage');
-                                map.setCenter(placeCenter.transform(gg, sm), 15);
+                                setTimeout(function() {
+                                    map.setCenter(placeCenter.transform(gg, sm), 15); 
+                                }, 100 );
                             })
                             .show();
                     });



More information about the Commits mailing list