Skip to content

Commit

Permalink
Merge pull request #1655 from rldhont/server_embedded_layers
Browse files Browse the repository at this point in the history
[BUGFIX] #11484 QGIS server: embedded layers are not published (GetCapabilities, GetMap, etc)



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
2 parents 444bea5 + d64525c commit 8d26a95
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 8d26a95

Please sign in to comment.