[Marble-commits] KDE/kdeedu/marble/src/lib/routing
Dennis Nienhüser
earthwings at gentoo.org
Thu Oct 28 20:44:07 CEST 2010
SVN commit 1190740 by nienhueser:
Support route export in kml format as well.
M +6 -1 RoutingLayer.cpp
M +5 -0 RoutingManager.cpp
M +6 -0 RoutingManager.h
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingLayer.cpp #1190739:1190740
@@ -22,6 +22,7 @@
#include "RouteRequest.h"
#include "MarbleModel.h"
#include "AlternativeRoutesModel.h"
+#include "RoutingManager.h"
#include <QtCore/QMap>
#include <QtGui/QAbstractProxyModel>
@@ -781,16 +782,20 @@
QString fileName = QFileDialog::getSaveFileName( d->m_marbleWidget,
tr( "Export Route" ), // krazy:exclude=qclasses
QDir::homePath(),
- tr( "GPX files (*.gpx)" ) );
+ tr( "GPX and KML files (*.gpx *.kml)" ) );
if ( d->m_routingModel && !fileName.isEmpty() ) {
+ if ( fileName.endsWith( ".gpx", Qt::CaseInsensitive ) ) {
QFile gpx( fileName );
if ( gpx.open( QFile::WriteOnly) ) {
d->m_routingModel->exportGpx( &gpx );
gpx.close();
}
+ } else {
+ d->m_marbleWidget->model()->routingManager()->saveRoute( fileName );
}
}
+}
} // namespace Marble
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingManager.cpp #1190739:1190740
@@ -297,6 +297,11 @@
d->saveRoute( d->stateFile() );
}
+void RoutingManager::saveRoute( const QString &filename ) const
+{
+ d->saveRoute( filename );
+}
+
void RoutingManager::readSettings()
{
d->loadRoute( d->stateFile() );
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingManager.h #1190739:1190740
@@ -111,6 +111,12 @@
*/
void readSettings();
+ /**
+ * Saves the current route to the file with the given filename. Existing files
+ * will be overwritten. The route is saved in kml format.
+ */
+ void saveRoute( const QString &filename ) const;
+
public Q_SLOTS:
/** Update the route */
void updateRoute();
More information about the Marble-commits
mailing list