Skip to content
Permalink
Browse files

support relative paths for gpx datasources (fixes #11131)

  • Loading branch information
jef-n committed Oct 26, 2014
1 parent c8a76f8 commit e1ff0edfba67fea37fb9eebdf11062ddcefc3035
Showing with 22 additions and 0 deletions.
  1. +22 −0 src/core/qgsmaplayer.cpp
@@ -191,6 +191,12 @@ bool QgsMapLayer::readLayerXML( const QDomElement& layerElement )
theURIParts[0] = QgsProject::instance()->readPath( theURIParts[0] );
mDataSource = theURIParts.join( "|" );
}
else if ( provider == "gpx" )
{
QStringList theURIParts = mDataSource.split( "?" );
theURIParts[0] = QgsProject::instance()->readPath( theURIParts[0] );
mDataSource = theURIParts.join( "?" );
}
else if ( provider == "delimitedtext" )
{
QUrl urlSource = QUrl::fromEncoded( mDataSource.toAscii() );
@@ -466,6 +472,12 @@ bool QgsMapLayer::writeLayerXML( QDomElement& layerElement, QDomDocument& docume
theURIParts[0] = QgsProject::instance()->writePath( theURIParts[0], relativeBasePath );
src = theURIParts.join( "|" );
}
else if ( vlayer && vlayer->providerType() == "gpx" )
{
QStringList theURIParts = src.split( "?" );
theURIParts[0] = QgsProject::instance()->writePath( theURIParts[0], relativeBasePath );
src = theURIParts.join( "?" );
}
else if ( vlayer && vlayer->providerType() == "delimitedtext" )
{
QUrl urlSource = QUrl::fromEncoded( src.toAscii() );
@@ -1066,6 +1078,11 @@ QString QgsMapLayer::saveNamedStyle( const QString &theURI, bool &theResultFlag
QStringList theURIParts = theURI.split( "|" );
filename = theURIParts[0];
}
else if ( vlayer && vlayer->providerType() == "gpx" )
{
QStringList theURIParts = theURI.split( "?" );
filename = theURIParts[0];
}
else if ( vlayer && vlayer->providerType() == "delimitedtext" )
{
filename = QUrl::fromEncoded( theURI.toAscii() ).toLocalFile();
@@ -1244,6 +1261,11 @@ QString QgsMapLayer::saveSldStyle( const QString &theURI, bool &theResultFlag )
QStringList theURIParts = theURI.split( "|" );
filename = theURIParts[0];
}
else if ( vlayer->providerType() == "gpx" )
{
QStringList theURIParts = theURI.split( "?" );
filename = theURIParts[0];
}
else if ( vlayer->providerType() == "delimitedtext" )
{
filename = QUrl::fromEncoded( theURI.toAscii() ).toLocalFile();

0 comments on commit e1ff0ed

Please sign in to comment.
You can’t perform that action at this time.