Skip to content
Permalink
Browse files

handle basemaps in QgsPathResolver

  • Loading branch information
3nids committed May 14, 2020
1 parent 75a991c commit 6bfc7194e3ad1e879c992f34ea4933a8dd2b92de
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/core/qgspathresolver.cpp
@@ -14,13 +14,15 @@
***************************************************************************/

#include "qgspathresolver.h"
#include "qgsbasemappathregistry.h"

#include "qgis.h"
#include "qgsapplication.h"
#include <QFileInfo>
#include <QUrl>
#include <QUuid>


typedef std::vector< std::pair< QString, std::function< QString( const QString & ) > > > CustomResolvers;
Q_GLOBAL_STATIC( CustomResolvers, sCustomResolvers )

@@ -48,6 +50,12 @@ QString QgsPathResolver::readPath( const QString &f ) const
return QgsApplication::pkgDataPath() + QStringLiteral( "/resources" ) + src.mid( 8 );
}

if ( src.startsWith( QLatin1String( "basemap:" ) ) )
{
// strip away "inbuilt:" prefix, replace with actual inbuilt data folder path
return QgsApplication::basemapPathRegistry()->fullPath( src.mid( 8 ) ) ;
}

if ( mBaseFileName.isNull() )
{
return src;
@@ -183,6 +191,10 @@ QString QgsPathResolver::writePath( const QString &src ) const
return src;
}

QString basemapPath = QgsApplication::basemapPathRegistry()->relativePath( src );
if ( !basemapPath.isEmpty() )
return QStringLiteral( "basemap:" ) + basemapPath;

if ( src.startsWith( QgsApplication::pkgDataPath() + QStringLiteral( "/resources" ) ) )
{
// replace inbuilt data folder path with "inbuilt:" prefix

0 comments on commit 6bfc719

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