Cleanup config cache

This commit is contained in:
Marco Hugentobler 2014-04-07 14:28:28 +02:00
parent 4e28719695
commit fd8c92f3e3
6 changed files with 13 additions and 27 deletions

View File

@ -350,7 +350,7 @@ int main( int argc, char * argv[] )
} }
else //WMS else else //WMS else
{ {
QgsWMSConfigParser* p = QgsConfigCache::instance()->wmsConfiguration( configFilePath ); QgsWMSConfigParser* p = QgsConfigCache::instance()->wmsConfiguration( configFilePath, parameterMap );
if ( !p ) if ( !p )
{ {
//error handling //error handling

View File

@ -19,6 +19,7 @@
#include "qgswcsprojectparser.h" #include "qgswcsprojectparser.h"
#include "qgswfsprojectparser.h" #include "qgswfsprojectparser.h"
#include "qgswmsprojectparser.h" #include "qgswmsprojectparser.h"
#include "qgssldconfigparser.h"
QgsConfigCache* QgsConfigCache::instance() QgsConfigCache* QgsConfigCache::instance()
{ {
@ -74,7 +75,7 @@ QgsWFSProjectParser* QgsConfigCache::wfsConfiguration( const QString& filePath )
return p; return p;
} }
QgsWMSConfigParser* QgsConfigCache::wmsConfiguration( const QString& filePath ) QgsWMSConfigParser* QgsConfigCache::wmsConfiguration( const QString& filePath, const QMap<QString, QString>& parameterMap )
{ {
QgsWMSConfigParser* p = mWMSConfigCache.object( filePath ); QgsWMSConfigParser* p = mWMSConfigCache.object( filePath );
if ( p ) if ( p )
@ -93,6 +94,7 @@ QgsWMSConfigParser* QgsConfigCache::wmsConfiguration( const QString& filePath )
QDomElement documentElem = doc->documentElement(); QDomElement documentElem = doc->documentElement();
if ( documentElem.tagName() == "StyledLayerDescriptor" ) if ( documentElem.tagName() == "StyledLayerDescriptor" )
{ {
p = new QgsSLDConfigParser( doc, parameterMap );
} }
else else
{ {

View File

@ -20,6 +20,7 @@
#include <QCache> #include <QCache>
#include <QFileSystemWatcher> #include <QFileSystemWatcher>
#include <QMap>
#include <QObject> #include <QObject>
class QgsWCSProjectParser; class QgsWCSProjectParser;
@ -37,7 +38,7 @@ class QgsConfigCache: public QObject
QgsWCSProjectParser* wcsConfiguration( const QString& filePath ); QgsWCSProjectParser* wcsConfiguration( const QString& filePath );
QgsWFSProjectParser* wfsConfiguration( 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: private:
QgsConfigCache(); QgsConfigCache();

View File

@ -329,6 +329,11 @@ QgsRectangle QgsServerProjectParser::projectExtent() const
return extent; return extent;
} }
int QgsServerProjectParser::numberOfLayers() const
{
return mProjectLayerElements.size();
}
QString QgsServerProjectParser::layerName( const QDomElement& layerElem ) const QString QgsServerProjectParser::layerName( const QDomElement& layerElem ) const
{ {
if ( layerElem.isNull() ) if ( layerElem.isNull() )

View File

@ -117,6 +117,8 @@ class QgsServerProjectParser
QgsRectangle projectExtent() const; QgsRectangle projectExtent() const;
int numberOfLayers() const;
private: private:
/**Content of project file*/ /**Content of project file*/

View File

@ -1591,30 +1591,6 @@ int QgsWMSServer::initializeSLDParser( QStringList& layersList, QStringList& sty
layersList << *layersIt; layersList << *layersIt;
stylesList << *stylesIt; 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; return 0;
} }