Fixes #3872: Companion export to Google Earth now converts feet to meters if GPS altitude is logged in feet.
This commit is contained in:
@@ -275,6 +275,8 @@ void LogsDialog::exportToGoogleEarth()
|
|||||||
if (n==0) return;
|
if (n==0) return;
|
||||||
|
|
||||||
int gpscol=0, altcol=0, speedcol=0;
|
int gpscol=0, altcol=0, speedcol=0;
|
||||||
|
double altMultiplier = 1.0;
|
||||||
|
|
||||||
QSet<int> nondataCols;
|
QSet<int> nondataCols;
|
||||||
for (int i=1; i<dataPoints.at(0).count(); i++) {
|
for (int i=1; i<dataPoints.at(0).count(); i++) {
|
||||||
// Long,Lat,Course,GPS Speed,GPS Alt
|
// Long,Lat,Course,GPS Speed,GPS Alt
|
||||||
@@ -284,6 +286,9 @@ void LogsDialog::exportToGoogleEarth()
|
|||||||
if (dataPoints.at(0).at(i).contains("GAlt")) {
|
if (dataPoints.at(0).at(i).contains("GAlt")) {
|
||||||
altcol = i;
|
altcol = i;
|
||||||
nondataCols << i;
|
nondataCols << i;
|
||||||
|
if (dataPoints.at(0).at(i).contains("(ft)")) {
|
||||||
|
altMultiplier = 0.3048; // feet to meters
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (dataPoints.at(0).at(i).contains("GSpd")) {
|
if (dataPoints.at(0).at(i).contains("GSpd")) {
|
||||||
speedcol = i;
|
speedcol = i;
|
||||||
@@ -295,7 +300,7 @@ void LogsDialog::exportToGoogleEarth()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// qDebug() << "gpscol" << gpscol << "altcol" << altcol << "speedcol" << speedcol;
|
// qDebug() << "gpscol" << gpscol << "altcol" << altcol << "speedcol" << speedcol << "altMultiplier" << altMultiplier;
|
||||||
QString geIconFilename = generateProcessUniqueTempFileName("track0.png");
|
QString geIconFilename = generateProcessUniqueTempFileName("track0.png");
|
||||||
if (QFile::exists(geIconFilename)) {
|
if (QFile::exists(geIconFilename)) {
|
||||||
QFile::remove(geIconFilename);
|
QFile::remove(geIconFilename);
|
||||||
@@ -363,7 +368,7 @@ void LogsDialog::exportToGoogleEarth()
|
|||||||
outputStream.setRealNumberPrecision(8);
|
outputStream.setRealNumberPrecision(8);
|
||||||
for (int i=1; i<n; i++) {
|
for (int i=1; i<n; i++) {
|
||||||
GpsCoord coord = extractGpsCoordinates(dataPoints.at(i).at(gpscol));
|
GpsCoord coord = extractGpsCoordinates(dataPoints.at(i).at(gpscol));
|
||||||
int altitude = altcol ? dataPoints.at(i).at(altcol).toFloat() : 0;
|
int altitude = altcol ? (dataPoints.at(i).at(altcol).toFloat() * altMultiplier) : 0;
|
||||||
outputStream << "\t\t\t\t\t<gx:coord>" << coord.longitude << " " << coord.latitude << " " << altitude << " </gx:coord>\n" ;
|
outputStream << "\t\t\t\t\t<gx:coord>" << coord.longitude << " " << coord.latitude << " " << altitude << " </gx:coord>\n" ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user