mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 08:38:45 +00:00
Add support for Google Earth (KML)
This patch adds an 'Export to KML' option to the ride menu. It will create a .kml file including power, hr, torque etc. These can be viewed alongside the map view in Google Earth 5.2. Please note this requires libkml. The features of libkml that are required were introduced in revision 852 which means that as of Aug 2010 you will need to checkout from the SVN source repo and build; svn checkout http://libkml.googlecode.com/svn/trunk/ libkml-read-only and the ./configure mantra that worked successfully for me on Mac OS X was; ./configure CC="gcc -arch i386" CXX="g++ -arch i386" --disable-swig Building on WIN32 is currently fraught with issues, unless you build via MSVC 2010. Linux is straight forward but you will need to install / apt-get libcurl. Fixes #133.
This commit is contained in:
@@ -29,6 +29,9 @@
|
||||
#include "ConfigDialog.h"
|
||||
#include "CriticalPowerWindow.h"
|
||||
#include "GcRideFile.h"
|
||||
#ifdef GC_HAVE_KML
|
||||
#include "KmlRideFile.h"
|
||||
#endif
|
||||
#include "PwxRideFile.h"
|
||||
#include "LTMWindow.h"
|
||||
#include "PfPvWindow.h"
|
||||
@@ -374,6 +377,10 @@ MainWindow::MainWindow(const QDir &home) :
|
||||
SLOT(exportCSV()), tr("Ctrl+E"));
|
||||
rideMenu->addAction(tr("Export to GC..."), this,
|
||||
SLOT(exportGC()));
|
||||
#ifdef GC_HAVE_KML
|
||||
rideMenu->addAction(tr("&Export to KML..."), this,
|
||||
SLOT(exportKML()));
|
||||
#endif
|
||||
rideMenu->addAction(tr("Export to PWX..."), this,
|
||||
SLOT(exportPWX()));
|
||||
rideMenu->addSeparator ();
|
||||
@@ -713,6 +720,28 @@ MainWindow::exportGC()
|
||||
reader.writeRideFile(currentRide(), file);
|
||||
}
|
||||
|
||||
#ifdef GC_HAVE_KML
|
||||
void
|
||||
MainWindow::exportKML()
|
||||
{
|
||||
if ((treeWidget->selectedItems().size() != 1)
|
||||
|| (treeWidget->selectedItems().first()->type() != RIDE_TYPE)) {
|
||||
QMessageBox::critical(this, tr("Select Ride"), tr("No ride selected!"));
|
||||
return;
|
||||
}
|
||||
|
||||
QString fileName = QFileDialog::getSaveFileName(
|
||||
this, tr("Export KML"), QDir::homePath(), tr("Google Earth KML (*.kml)"));
|
||||
if (fileName.length() == 0)
|
||||
return;
|
||||
|
||||
QString err;
|
||||
QFile file(fileName);
|
||||
KmlFileReader reader;
|
||||
reader.writeRideFile(currentRide(), file);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
MainWindow::exportCSV()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user