Skip to content

Commit

Permalink
support relative paths for gpx datasources (fixes #11131)
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Oct 26, 2014
1 parent c8a76f8 commit e1ff0ed
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/core/qgsmaplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down Expand Up @@ -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() );
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit e1ff0ed

Please sign in to comment.