Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
parse embedded project only once (speedups loading of multiple embedd…
…ed layers from the same project)
- Loading branch information
Showing
with
19 additions
and
8 deletions.
-
+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? |
|
|