Skip to content

Commit

Permalink
Cleanup config cache
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Apr 7, 2014
1 parent 4e28719 commit fd8c92f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/mapserver/qgis_map_serv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/mapserver/qgsconfigcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "qgswcsprojectparser.h"
#include "qgswfsprojectparser.h"
#include "qgswmsprojectparser.h"
#include "qgssldconfigparser.h"

QgsConfigCache* QgsConfigCache::instance()
{
Expand Down Expand Up @@ -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 )
Expand All @@ -93,6 +94,7 @@ QgsWMSConfigParser* QgsConfigCache::wmsConfiguration( const QString& filePath )
QDomElement documentElem = doc->documentElement();
if ( documentElem.tagName() == "StyledLayerDescriptor" )
{
p = new QgsSLDConfigParser( doc, parameterMap );
}
else
{
Expand Down
3 changes: 2 additions & 1 deletion src/mapserver/qgsconfigcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

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

class QgsWCSProjectParser;
Expand All @@ -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();
Expand Down
5 changes: 5 additions & 0 deletions src/mapserver/qgsserverprojectparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() )
Expand Down
2 changes: 2 additions & 0 deletions src/mapserver/qgsserverprojectparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ class QgsServerProjectParser

QgsRectangle projectExtent() const;

int numberOfLayers() const;

private:

/**Content of project file*/
Expand Down
24 changes: 0 additions & 24 deletions src/mapserver/qgswmsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit fd8c92f

Please sign in to comment.