Skip to content
Permalink
Browse files

Merge pull request #1655 from rldhont/server_embedded_layers

[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 8d26a95eb61ca9497154e7bbbc167663b396604f
Showing with 11 additions and 12 deletions.
  1. +6 −0 src/mapserver/qgsconfigcache.cpp
  2. +2 −0 src/mapserver/qgsconfigcache.h
  3. +3 −12 src/mapserver/qgsserverprojectparser.cpp
@@ -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 );
@@ -23,6 +23,7 @@
#include <QMap>
#include <QObject>

class QgsServerProjectParser;
class QgsWCSProjectParser;
class QgsWFSProjectParser;
class QgsWMSConfigParser;
@@ -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 >() ) );
@@ -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 )

0 comments on commit 8d26a95

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