mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 08:38:45 +00:00
strava map jagged fix - issue was the conversion of gps coord to string
didn't have enough precision. Found all (most) of the gps coord to string conversions and used a constant to insure all conversions occur with the same precision. Signed-off-by: Greg Lonnon <greg.lonnon@gmail.com>
This commit is contained in:
@@ -243,7 +243,10 @@ void GoogleMapControl::createHtml()
|
||||
" webBridge.drawOverlays();\n"
|
||||
|
||||
"}\n"
|
||||
"</script>\n").arg(minLat,0,'g',11).arg(minLon,0,'g',11).arg(maxLat,0,'g',11).arg(maxLon,0,'g',11);
|
||||
"</script>\n").arg(minLat,0,'g',GPS_COORD_TO_STRING).
|
||||
arg(minLon,0,'g',GPS_COORD_TO_STRING).
|
||||
arg(maxLat,0,'g',GPS_COORD_TO_STRING).
|
||||
arg(maxLon,0,'g',GPS_COORD_TO_STRING);
|
||||
|
||||
// the main page is rather trivial
|
||||
currentPage += QString("</head>\n"
|
||||
@@ -280,7 +283,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,0,'g',11).arg(rfp->lon,0,'g',11);
|
||||
code += QString("path.push(new google.maps.LatLng(%1,%2));\n").arg(rfp->lat,0,'g',GPS_COORD_TO_STRING).arg(rfp->lon,0,'g',GPS_COORD_TO_STRING);
|
||||
}
|
||||
|
||||
// running total of time
|
||||
@@ -355,20 +358,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,0,'g',11).arg(points[0]->lon,0,'g',11);
|
||||
"marker.setMap(map); }").arg(points[0]->lat,0,'g',GPS_COORD_TO_STRING).arg(points[0]->lon,0,'g',GPS_COORD_TO_STRING);
|
||||
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,0,'g',11).arg(points[0]->lon,0,'g',11);
|
||||
"marker.setMap(map); }").arg(points[0]->lat,0,'g',GPS_COORD_TO_STRING).arg(points[0]->lon,0,'g',GPS_COORD_TO_STRING);
|
||||
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,0,'g',11).arg(points[points.count()-1]->lon,0,'g',11);
|
||||
"marker.setMap(map); }").arg(points[points.count()-1]->lat,0,'g',GPS_COORD_TO_STRING).arg(points[points.count()-1]->lon,0,'g',GPS_COORD_TO_STRING);
|
||||
view->page()->mainFrame()->evaluateJavaScript(code);
|
||||
}
|
||||
|
||||
@@ -414,7 +417,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,0,'g',11).arg(rfp->lon,0,'g',11);
|
||||
"}").arg(rfp->lat,0,'g',GPS_COORD_TO_STRING).arg(rfp->lon,0,'g',GPS_COORD_TO_STRING);
|
||||
view->page()->mainFrame()->evaluateJavaScript(code);
|
||||
stoptime=0;
|
||||
}
|
||||
@@ -440,8 +443,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,0,'g',11)
|
||||
.arg(myRideItem->ride()->dataPoints()[offset]->lon,0,'g',11)
|
||||
.arg(myRideItem->ride()->dataPoints()[offset]->lat,0,'g',GPS_COORD_TO_STRING)
|
||||
.arg(myRideItem->ride()->dataPoints()[offset]->lon,0,'g',GPS_COORD_TO_STRING)
|
||||
.arg(x.name)
|
||||
.arg(interval);
|
||||
view->page()->mainFrame()->evaluateJavaScript(code);
|
||||
@@ -486,10 +489,10 @@ void GoogleMapControl::zoomInterval(IntervalItem *which)
|
||||
"var northeast = new google.maps.LatLng(%3, %4);\n"
|
||||
"var bounds = new google.maps.LatLngBounds(southwest, northeast);\n"
|
||||
"map.fitBounds(bounds);\n }")
|
||||
.arg(minLat,0,'g',11)
|
||||
.arg(minLon,0,'g',11)
|
||||
.arg(maxLat,0,'g',11)
|
||||
.arg(maxLon,0,'g',11);
|
||||
.arg(minLat,0,'g',GPS_COORD_TO_STRING)
|
||||
.arg(minLon,0,'g',GPS_COORD_TO_STRING)
|
||||
.arg(maxLat,0,'g',GPS_COORD_TO_STRING)
|
||||
.arg(maxLon,0,'g',GPS_COORD_TO_STRING);
|
||||
view->page()->mainFrame()->evaluateJavaScript(code);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user