Fix Map Jaggies & Stoptime

The recent update for the Google Map window reduced the
precision geo-coordinates, this patch fixes that.

Additionally, the wait time was triggered after 60s which
should be 5 minutes (left in by mistake after testing).
This commit is contained in:
Mark Liversedge
2011-07-24 00:50:18 +01:00
parent 58c9bf5334
commit a270217923

View File

@@ -305,7 +305,7 @@ void GoogleMapControl::createHtml()
" webBridge.drawOverlays();\n"
"}\n"
"</script>\n").arg(minLat).arg(minLon).arg(maxLat).arg(maxLon);
"</script>\n").arg(minLat,0,'g',6).arg(minLon,0,'g',6).arg(maxLat,0,'g',6).arg(maxLon,0,'g',6);
// the main page is rather trivial
currentPage += QString("</head>\n"
@@ -343,7 +343,7 @@ GoogleMapControl::drawShadedRoute()
" path = polyline.getPath();\n");
} else {
if (rfp->lat || rfp->lon)
code += QString("path.push(new google.maps.LatLng(%1,%2));\n").arg(rfp->lat).arg(rfp->lon);
code += QString("path.push(new google.maps.LatLng(%1,%2));\n").arg(rfp->lat,0,'g',6).arg(rfp->lon,0,'g',6);
}
// running total of time
@@ -433,21 +433,20 @@ GoogleMapControl::createMarkers()
code = QString("{ var latlng = new google.maps.LatLng(%1,%2);"
"var image = new google.maps.MarkerImage('qrc:images/maps/loop.png');"
"var marker = new google.maps.Marker({ icon: image, animation: google.maps.Animation.DROP, position: latlng });"
"marker.setMap(map); }").arg(points[0]->lat).arg(points[0]->lon);
"marker.setMap(map); }").arg(points[0]->lat,0,'g',6).arg(points[0]->lon,0,'g',6);
view->page()->mainFrame()->evaluateJavaScript(code);
} else {
// start / finish markers
code = QString("{ var latlng = new google.maps.LatLng(%1,%2);"
"var image = new google.maps.MarkerImage('qrc:images/maps/cycling.png');"
"var marker = new google.maps.Marker({ icon: image, animation: google.maps.Animation.DROP, position: latlng });"
"marker.setMap(map); }").arg(points[0]->lat).arg(points[0]->lon);
"marker.setMap(map); }").arg(points[0]->lat,0,'g',6).arg(points[0]->lon,0,'g',6);
view->page()->mainFrame()->evaluateJavaScript(code);
code = QString("{ var latlng = new google.maps.LatLng(%1,%2);"
"var image = new google.maps.MarkerImage('qrc:images/maps/finish.png');"
"var marker = new google.maps.Marker({ icon: image, animation: google.maps.Animation.DROP, position: latlng });"
"marker.setMap(map); }").arg(points[points.count()-1]->lat).arg(points[points.count()-1]->lon);
"marker.setMap(map); }").arg(points[points.count()-1]->lat,0,'g',6).arg(points[points.count()-1]->lon,0,'g',6);
view->page()->mainFrame()->evaluateJavaScript(code);
}
@@ -458,7 +457,7 @@ GoogleMapControl::createMarkers()
double laststoptime=0;
double lastlat=0, lastlon=0;
int stoptime=0;
static const int BEERANDBURRITO = 60; // anything longer than 60 seconds?
static const int BEERANDBURRITO = 300; // anything longer than 5 minutes
foreach(RideFilePoint *rfp, myRideItem->ride()->dataPoints())
{
@@ -493,7 +492,7 @@ GoogleMapControl::createMarkers()
"var image = new google.maps.MarkerImage('qrc:images/maps/cycling_feed.png');"
"var marker = new google.maps.Marker({ icon: image, animation: google.maps.Animation.DROP, position: latlng });"
"marker.setMap(map);"
"}").arg(rfp->lat).arg(rfp->lon);
"}").arg(rfp->lat,0,'g',6).arg(rfp->lon,0,'g',6);
view->page()->mainFrame()->evaluateJavaScript(code);
stoptime=0;
}
@@ -519,8 +518,8 @@ GoogleMapControl::createMarkers()
" markerList.push(marker);" // keep track of those suckers
" google.maps.event.addListener(marker, 'click', function(event) { webBridge.toggleInterval(%4); });"
"}")
.arg(myRideItem->ride()->dataPoints()[offset]->lat)
.arg(myRideItem->ride()->dataPoints()[offset]->lon)
.arg(myRideItem->ride()->dataPoints()[offset]->lat,0,'g',6)
.arg(myRideItem->ride()->dataPoints()[offset]->lon,0,'g',6)
.arg(x.name)
.arg(interval);
view->page()->mainFrame()->evaluateJavaScript(code);