mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Merge pull request #10 from glonnon/strava_fix
Greg Lonnon fix for Strava and more general GPS precision
This commit is contained in:
@@ -240,7 +240,7 @@ void BingMap::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"
|
||||
@@ -275,7 +275,7 @@ BingMap::drawShadedRoute()
|
||||
code = QString("{\nvar route = new Array();\n");
|
||||
} else {
|
||||
if (rfp->lat || rfp->lon)
|
||||
code += QString("route.push(new Microsoft.Maps.Location(%1,%2));\n").arg(rfp->lat,0,'g',11).arg(rfp->lon,0,'g',11);
|
||||
code += QString("route.push(new Microsoft.Maps.Location(%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
|
||||
@@ -354,7 +354,7 @@ BingMap::createMarkers()
|
||||
"var pushpinOptions = { icon: 'qrc:images/maps/loop.png', height: 37, width: 32 };"
|
||||
"var pushpin = new Microsoft.Maps.Pushpin(latlng, pushpinOptions);"
|
||||
"map.entities.push(pushpin); }"
|
||||
).arg(points[0]->lat,0,'g',11).arg(points[0]->lon,0,'g',11);
|
||||
).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);
|
||||
|
||||
@@ -364,14 +364,14 @@ BingMap::createMarkers()
|
||||
"var pushpinOptions = { icon: 'qrc:images/maps/cycling.png', height: 37, width: 32 };"
|
||||
"var pushpin = new Microsoft.Maps.Pushpin(latlng, pushpinOptions);"
|
||||
"map.entities.push(pushpin); }"
|
||||
).arg(points[0]->lat,0,'g',11).arg(points[0]->lon,0,'g',11);
|
||||
).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 Microsoft.Maps.Location(%1,%2); "
|
||||
"var pushpinOptions = { icon: 'qrc:images/maps/finish.png', height: 37, width: 32 };"
|
||||
"var pushpin = new Microsoft.Maps.Pushpin(latlng, pushpinOptions);"
|
||||
"map.entities.push(pushpin); }"
|
||||
).arg(points[points.count()-1]->lat,0,'g',11).arg(points[points.count()-1]->lon,0,'g',11);
|
||||
).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);
|
||||
}
|
||||
|
||||
@@ -416,7 +416,7 @@ BingMap::createMarkers()
|
||||
"var pushpinOptions = { icon: 'qrc:images/maps/cycling_feed.png', height: 37, width: 32 };"
|
||||
"var pushpin = new Microsoft.Maps.Pushpin(latlng, pushpinOptions);"
|
||||
"map.entities.push(pushpin); }"
|
||||
).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;
|
||||
}
|
||||
@@ -441,8 +441,8 @@ BingMap::createMarkers()
|
||||
"pushpin.cm1001_er_etr.dom.setAttribute('title', '%3');\n"
|
||||
"pushpinClick= Microsoft.Maps.Events.addHandler(pushpin, 'click', function(event) { webBridge.toggleInterval(%4); });\n"
|
||||
" }")
|
||||
.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);
|
||||
|
||||
@@ -489,10 +489,10 @@ void BingMap::zoomInterval(IntervalItem *which)
|
||||
" new Microsoft.Maps.Location(%1,%2), "
|
||||
" new Microsoft.Maps.Location(%3,%4));\n"
|
||||
" map.setView( { bounds: viewBounds });\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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <QUrl>
|
||||
#include <QScriptEngine>
|
||||
#include "TimeUtils.h"
|
||||
#include "Units.h"
|
||||
|
||||
// acccess to metrics
|
||||
#include "MetricAggregator.h"
|
||||
@@ -296,7 +297,7 @@ StravaDialog::requestUpload()
|
||||
|
||||
connect(&networkMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestUploadFinished(QNetworkReply*)));
|
||||
connect(&networkMgr, SIGNAL(finished(QNetworkReply *)), &eventLoop, SLOT(quit()));
|
||||
QByteArray out;
|
||||
QString out;
|
||||
|
||||
QVector<RideFilePoint*> vectorPoints = ride->ride()->dataPoints();
|
||||
int totalSize = vectorPoints.size();
|
||||
@@ -318,9 +319,9 @@ StravaDialog::requestUpload()
|
||||
out += "[\"";
|
||||
out += rideDateTime.toString("yyyy-MM-ddThh:mm:ss-0600");
|
||||
out += "\",";
|
||||
out += QString("%1").arg(point->lat);
|
||||
out += QString("%1").arg(point->lat,0,'f',GPS_COORD_TO_STRING);
|
||||
out += ",";
|
||||
out += QString("%1").arg(point->lon);
|
||||
out += QString("%1").arg(point->lon,0,'f',GPS_COORD_TO_STRING);
|
||||
out += ",";
|
||||
out += QString("%1").arg(point->alt);
|
||||
out += ",";
|
||||
@@ -346,7 +347,7 @@ StravaDialog::requestUpload()
|
||||
progressBar->setValue(40);
|
||||
progressLabel->setText(tr("Upload ride... Sending"));
|
||||
|
||||
networkMgr.post( request, out);
|
||||
networkMgr.post( request, out.toAscii());
|
||||
eventLoop.exec();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#define KG_PER_LB 0.45359237
|
||||
#define FAHRENHEIT_PER_CENTIGRADE 1.8
|
||||
#define FAHRENHEIT_ADD_CENTIGRADE 32
|
||||
#define GPS_COORD_TO_STRING 8
|
||||
|
||||
#endif // _GC_Units_h
|
||||
|
||||
|
||||
Reference in New Issue
Block a user