Skip to content
Permalink
Browse files
Cleanup config cache
  • Loading branch information
mhugent committed Apr 7, 2014
1 parent 4e28719 commit fd8c92f3e3ccc9ece8a60bbba4a8328b8598f40d
@@ -350,7 +350,7 @@ int main( int argc, char * argv[] )
}
else //WMS else
{
QgsWMSConfigParser* p = QgsConfigCache::instance()->wmsConfiguration( configFilePath );
QgsWMSConfigParser* p = QgsConfigCache::instance()->wmsConfiguration( configFilePath, parameterMap );
if ( !p )
{
//error handling
@@ -19,6 +19,7 @@
#include "qgswcsprojectparser.h"
#include "qgswfsprojectparser.h"
#include "qgswmsprojectparser.h"
#include "qgssldconfigparser.h"

QgsConfigCache* QgsConfigCache::instance()
{
@@ -74,7 +75,7 @@ QgsWFSProjectParser* QgsConfigCache::wfsConfiguration( const QString& filePath )
return p;
}

QgsWMSConfigParser* QgsConfigCache::wmsConfiguration( const QString& filePath )
QgsWMSConfigParser* QgsConfigCache::wmsConfiguration( const QString& filePath, const QMap<QString, QString>& parameterMap )
{
QgsWMSConfigParser* p = mWMSConfigCache.object( filePath );
if ( p )
@@ -93,6 +94,7 @@ QgsWMSConfigParser* QgsConfigCache::wmsConfiguration( const QString& filePath )
QDomElement documentElem = doc->documentElement();
if ( documentElem.tagName() == "StyledLayerDescriptor" )
{
p = new QgsSLDConfigParser( doc, parameterMap );
}
else
{
@@ -20,6 +20,7 @@

#include <QCache>
#include <QFileSystemWatcher>
#include <QMap>
#include <QObject>

class QgsWCSProjectParser;
@@ -37,7 +38,7 @@ class QgsConfigCache: public QObject

QgsWCSProjectParser* wcsConfiguration( const QString& filePath );
QgsWFSProjectParser* wfsConfiguration( const QString& filePath );
QgsWMSConfigParser* wmsConfiguration( const QString& filePath );
QgsWMSConfigParser* wmsConfiguration( const QString& filePath, const QMap<QString, QString>& parameterMap = QMap< QString, QString >() );

private:
QgsConfigCache();
@@ -329,6 +329,11 @@ QgsRectangle QgsServerProjectParser::projectExtent() const
return extent;
}

int QgsServerProjectParser::numberOfLayers() const
{
return mProjectLayerElements.size();
}

QString QgsServerProjectParser::layerName( const QDomElement& layerElem ) const
{
if ( layerElem.isNull() )
@@ -117,6 +117,8 @@ class QgsServerProjectParser

QgsRectangle projectExtent() const;

int numberOfLayers() const;

private:

/**Content of project file*/
@@ -1591,30 +1591,6 @@ int QgsWMSServer::initializeSLDParser( QStringList& layersList, QStringList& sty
layersList << *layersIt;
stylesList << *stylesIt;
}

#if 0 //todo: fixme
QgsSLDParser* userSLDParser = new QgsSLDParser( theDocument );
userSLDParser->setParameterMap( mParameters );
userSLDParser->setFallbackParser( mConfigParser );
mConfigParser = userSLDParser;
//now replace the content of layersList and stylesList (if present)
layersList.clear();
stylesList.clear();
QStringList layersSTDList;
QStringList stylesSTDList;
if ( mConfigParser->layersAndStyles( layersSTDList, stylesSTDList ) != 0 )
{
QgsDebugMsg( "Error, no layers and styles found in SLD" );
return 0;
}
QStringList::const_iterator layersIt;
QStringList::const_iterator stylesIt;
for ( layersIt = layersSTDList.constBegin(), stylesIt = stylesSTDList.constBegin(); layersIt != layersSTDList.constEnd(); ++layersIt, ++stylesIt )
{
layersList << *layersIt;
stylesList << *stylesIt;
}
#endif //0 //todo: fixme
}
return 0;
}

0 comments on commit fd8c92f

Please sign in to comment.