Skip to content
Permalink
Browse files

parse embedded project only once (speedups loading of multiple embedd…

…ed layers from the same project)
  • Loading branch information
jef-n committed Nov 12, 2014
1 parent b5f6d2c commit e4cd5520a83115a155d303ccf614e755a1a7e3a5
Showing with 19 additions and 8 deletions.
  1. +19 −8 src/core/qgsproject.cpp
@@ -1689,16 +1689,27 @@ QString QgsProject::layerIsEmbedded( const QString& id ) const
bool QgsProject::createEmbeddedLayer( const QString& layerId, const QString& projectFilePath, QList<QDomNode>& brokenNodes,
QList< QPair< QgsVectorLayer*, QDomElement > >& vectorLayerList, bool saveFlag )
{
QFile projectFile( projectFilePath );
if ( !projectFile.open( QIODevice::ReadOnly ) )
{
return false;
}
QgsDebugCall;

QDomDocument projectDocument;
if ( !projectDocument.setContent( &projectFile ) )
static QString prevProjectFilePath;
static QDomDocument projectDocument;

if ( projectFilePath != prevProjectFilePath )
{
return false;
prevProjectFilePath.clear();

QFile projectFile( projectFilePath );
if ( !projectFile.open( QIODevice::ReadOnly ) )
{
return false;
}

if ( !projectDocument.setContent( &projectFile ) )
{
return false;
}

prevProjectFilePath = projectFilePath;
}

//does project store pathes absolute or relative?

0 comments on commit e4cd552

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