Skip to content

Commit

Permalink
[BUGFIX] #11484 QGIS server: embedded layers are not published (GetCa…
Browse files Browse the repository at this point in the history
…pabilities, GetMap, etc)

Issue #1072 QGIS server: embedded groups do not render in GetMap requests if
 leave layers are requested has been fixed 40d9145

But another fix about embedded layers lacks. A fixme annotation is in the
 QgsServerProjectParser::createLayerFromElement. This one is about return the
 layer if it is embedded.

In QgsServerProjectParser::createLayerFromElement, we need to generate a
 QgsServerProjectParser of the parent project to return the mapLayer for
 embedded layers. To do it, I use QgsCacheConfig to get the
 QgsServerProjectParser for the parent project.

Funded by 3Liz.
  • Loading branch information
rldhont committed Oct 24, 2014
1 parent 6bde8a2 commit d64525c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
6 changes: 6 additions & 0 deletions src/mapserver/qgsconfigcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ QgsConfigCache::~QgsConfigCache()
{
}

QgsServerProjectParser* QgsConfigCache::serverConfiguration( const QString& filePath )
{
QDomDocument* doc = xmlDocument( filePath );
return new QgsServerProjectParser( doc, filePath );
}

QgsWCSProjectParser* QgsConfigCache::wcsConfiguration( const QString& filePath )
{
QgsWCSProjectParser* p = mWCSConfigCache.object( filePath );
Expand Down
2 changes: 2 additions & 0 deletions src/mapserver/qgsconfigcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <QMap>
#include <QObject>

class QgsServerProjectParser;
class QgsWCSProjectParser;
class QgsWFSProjectParser;
class QgsWMSConfigParser;
Expand All @@ -36,6 +37,7 @@ class QgsConfigCache: public QObject
static QgsConfigCache* instance();
~QgsConfigCache();

QgsServerProjectParser* serverConfiguration( const QString& filePath );
QgsWCSProjectParser* wcsConfiguration( const QString& filePath );
QgsWFSProjectParser* wfsConfiguration( const QString& filePath );
QgsWMSConfigParser* wmsConfiguration( const QString& filePath, const QMap<QString, QString>& parameterMap = ( QMap< QString, QString >() ) );
Expand Down
15 changes: 3 additions & 12 deletions src/mapserver/qgsserverprojectparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,24 +225,15 @@ QgsMapLayer* QgsServerProjectParser::createLayerFromElement( const QDomElement&
}
else if ( elem.attribute( "embedded" ) == "1" ) //layer is embedded from another project file
{
//todo: fixme
/*
QString project = convertToAbsolutePath( elem.attribute( "project" ) );
QgsDebugMsg( QString( "Project path: %1" ).arg( project ) );
QgsProjectParser* otherConfig = dynamic_cast<QgsProjectParser*>( QgsConfigCache::instance()->searchConfiguration( project ) );
QgsServerProjectParser* otherConfig = QgsConfigCache::instance()->serverConfiguration( project );
if ( !otherConfig )
{
return 0;
}
QHash< QString, QDomElement >::const_iterator layerIt = otherConfig->mProjectLayerElementsById.find( elem.attribute( "id" ) );
if ( layerIt == otherConfig->mProjectLayerElementsById.constEnd() )
{
return 0;
}
return otherConfig->createLayerFromElement( layerIt.value() );
*/
return otherConfig->mapLayerFromLayerId( elem.attribute( "id" ), useCache );
}

if ( layer )
Expand Down

0 comments on commit d64525c

Please sign in to comment.