Skip to content
Permalink
Browse files

Merge pull request #4019 from dmarteau/wms_cleanup

Clean WMS service
  • Loading branch information
rldhont committed Jan 19, 2017
2 parents b45469f + a80497e commit 53752ba365474dc3123f2b6344ec5c5891f85693
Showing with 1,118 additions and 1,199 deletions.
  1. +2 −2 src/server/CMakeLists.txt
  2. +0 −12 src/server/qgsconfigcache.cpp
  3. +0 −6 src/server/qgsconfigcache.h
  4. +7 −1 src/server/qgsfilterrestorer.cpp
  5. +1 −1 src/server/qgsfilterrestorer.h
  6. +9 −5 src/server/qgsserverinterfaceimpl.cpp
  7. +4 −6 src/server/qgswcsprojectparser.cpp
  8. +0 −6 src/server/qgswcsprojectparser.h
  9. +4 −6 src/server/qgswfsprojectparser.cpp
  10. +0 −6 src/server/qgswfsprojectparser.h
  11. +0 −12 src/server/qgswmsprojectparser.cpp
  12. +0 −6 src/server/qgswmsprojectparser.h
  13. +2 −2 src/server/services/wcs/qgswcsgetcoverage.cpp
  14. +2 −1 src/server/services/wfs/qgswfstransaction.cpp
  15. +2 −1 src/server/services/wms/CMakeLists.txt
  16. +5 −14 src/server/services/wms/qgsdxfwriter.cpp
  17. +3 −4 src/server/services/wms/qgsmaprendererjobproxy.cpp
  18. +0 −4 src/server/services/wms/qgsmaprendererjobproxy.h
  19. +325 −0 src/server/services/wms/qgsmediancut.cpp
  20. +46 −0 src/server/services/wms/qgsmediancut.h
  21. +35 −10 src/server/services/wms/qgswmsdescribelayer.cpp
  22. +6 −0 src/server/services/wms/qgswmsdescribelayer.h
  23. +211 −12 src/server/services/wms/qgswmsgetcapabilities.cpp
  24. +11 −0 src/server/services/wms/qgswmsgetcapabilities.h
  25. +36 −10 src/server/services/wms/qgswmsgetcontext.cpp
  26. +6 −0 src/server/services/wms/qgswmsgetcontext.h
  27. +3 −6 src/server/services/wms/qgswmsgetfeatureinfo.cpp
  28. +4 −9 src/server/services/wms/qgswmsgetlegendgraphics.cpp
  29. +4 −8 src/server/services/wms/qgswmsgetmap.cpp
  30. +3 −6 src/server/services/wms/qgswmsgetprint.cpp
  31. +48 −9 src/server/services/wms/qgswmsgetschemaextension.cpp
  32. +7 −0 src/server/services/wms/qgswmsgetschemaextension.h
  33. +28 −9 src/server/services/wms/qgswmsgetstyle.cpp
  34. +5 −0 src/server/services/wms/qgswmsgetstyle.h
  35. +29 −9 src/server/services/wms/qgswmsgetstyles.cpp
  36. +9 −0 src/server/services/wms/qgswmsgetstyles.h
  37. +141 −628 src/server/services/wms/{qgswmsservertransitional.cpp → qgswmsrenderer.cpp}
  38. +41 −75 src/server/services/wms/{qgswmsservertransitional.h → qgswmsrenderer.h}
  39. +29 −0 src/server/services/wms/qgswmsserviceexception.h
  40. +36 −306 src/server/services/wms/qgswmsutils.cpp
  41. +14 −7 src/server/services/wms/qgswmsutils.h
@@ -52,6 +52,8 @@ SET ( qgis_mapserv_SRCS
qgsfcgiserverresponse.cpp
qgsbufferserverresponse.cpp
qgsfilterresponsedecorator.cpp
qgsserverinterface.cpp
qgsserverinterfaceimpl.cpp
qgsfilterrestorer.cpp
#----------------------------
)
@@ -98,11 +100,9 @@ SET(qgis_mapserv_MOC_HDRS ${qgis_mapserv_MOC_HDRS})
IF (WITH_SERVER_PLUGINS)
SET(qgis_mapserv_SRCS ${qgis_mapserv_SRCS}
qgsserverplugins.cpp
qgsserverinterface.cpp
qgsserverfilter.cpp
qgsaccesscontrolfilter.cpp
qgsaccesscontrol.cpp
qgsserverinterfaceimpl.cpp
)
ENDIF (WITH_SERVER_PLUGINS)

@@ -79,9 +79,7 @@ QgsServerProjectParser* QgsConfigCache::serverConfiguration( const QString& file

QgsWCSProjectParser *QgsConfigCache::wcsConfiguration(
const QString& filePath
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, const QgsAccessControl* accessControl
#endif
)
{
QgsWCSProjectParser *p = mWCSConfigCache.object( filePath );
@@ -94,9 +92,7 @@ QgsWCSProjectParser *QgsConfigCache::wcsConfiguration(
}
p = new QgsWCSProjectParser(
filePath
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, accessControl
#endif
);
mWCSConfigCache.insert( filePath, p );
p = mWCSConfigCache.object( filePath );
@@ -109,9 +105,7 @@ QgsWCSProjectParser *QgsConfigCache::wcsConfiguration(

QgsWfsProjectParser *QgsConfigCache::wfsConfiguration(
const QString& filePath
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, const QgsAccessControl* accessControl
#endif
)
{
QgsWfsProjectParser *p = mWFSConfigCache.object( filePath );
@@ -124,9 +118,7 @@ QgsWfsProjectParser *QgsConfigCache::wfsConfiguration(
}
p = new QgsWfsProjectParser(
filePath
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, accessControl
#endif
);
mWFSConfigCache.insert( filePath, p );
p = mWFSConfigCache.object( filePath );
@@ -139,9 +131,7 @@ QgsWfsProjectParser *QgsConfigCache::wfsConfiguration(

QgsWmsConfigParser *QgsConfigCache::wmsConfiguration(
const QString& filePath
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, const QgsAccessControl* accessControl
#endif
, const QMap<QString, QString>& parameterMap
)
{
@@ -165,9 +155,7 @@ QgsWmsConfigParser *QgsConfigCache::wmsConfiguration(
{
p = new QgsWmsProjectParser(
filePath
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, accessControl
#endif
);
}
mWMSConfigCache.insert( filePath, p );
@@ -43,21 +43,15 @@ class SERVER_EXPORT QgsConfigCache : public QObject
QgsServerProjectParser* serverConfiguration( const QString& filePath );
QgsWCSProjectParser* wcsConfiguration(
const QString& filePath
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, const QgsAccessControl* accessControl
#endif
);
QgsWfsProjectParser* wfsConfiguration(
const QString& filePath
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, const QgsAccessControl* accessControl
#endif
);
QgsWmsConfigParser* wmsConfiguration(
const QString& filePath
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, const QgsAccessControl* accessControl
#endif
, const QMap<QString, QString>& parameterMap = ( QMap< QString, QString >() )
);

@@ -20,7 +20,12 @@
#include "qgsvectorlayer.h"
#include "qgsvectordataprovider.h"

//! Apply filter from AccessControl
#ifdef HAVE_SERVER_PYTHON_PLUGINS
#include "qgsaccesscontrol.h"
#endif

//! Apply filter from AccessControal
#ifdef HAVE_SERVER_PYTHON_PLUGINS
void QgsOWSServerFilterRestorer::applyAccessControlLayerFilters( const QgsAccessControl* accessControl, QgsMapLayer* mapLayer,
QHash<QgsMapLayer*, QString>& originalLayerFilters )
{
@@ -45,6 +50,7 @@ void QgsOWSServerFilterRestorer::applyAccessControlLayerFilters( const QgsAccess
}
}
}
#endif

//! Restore layer filter as original
void QgsOWSServerFilterRestorer::restoreLayerFilters( const QHash<QgsMapLayer*, QString>& filterMap )
@@ -18,12 +18,12 @@
#ifndef QGSFILTERRESTORER_H
#define QGSFILTERRESTORER_H

#include "qgsaccesscontrol.h"
#include "qgis_server.h"

#include <QHash>

class QgsMapLayer;
class QgsAccessControl;

/** RAII class to restore layer filters on destruction
*/
@@ -31,7 +31,7 @@ QgsServerInterfaceImpl::QgsServerInterfaceImpl( QgsCapabilitiesCache* capCache,
#ifdef HAVE_SERVER_PYTHON_PLUGINS
mAccessControls = new QgsAccessControl();
#else
mAccessControls = nullptr
mAccessControls = nullptr;
#endif
}

@@ -43,7 +43,9 @@ QString QgsServerInterfaceImpl::getEnv( const QString& name ) const

QgsServerInterfaceImpl::~QgsServerInterfaceImpl()
{
#ifdef HAVE_SERVER_PYTHON_PLUGINS
delete mAccessControls;
#endif
}


@@ -75,10 +77,12 @@ void QgsServerInterfaceImpl::setFilters( QgsServerFiltersMap* filters )
//! Register a new access control filter
void QgsServerInterfaceImpl::registerAccessControl( QgsAccessControlFilter* accessControl, int priority )
{
if ( mAccessControls )
{
mAccessControls->registerAccessControl( accessControl, priority );
}
#ifdef HAVE_SERVER_PYTHON_PLUGINS
mAccessControls->registerAccessControl( accessControl, priority );
#else
Q_UNUSED( accessControl );
Q_UNUSED( priority );
#endif
}


@@ -31,15 +31,13 @@

QgsWCSProjectParser::QgsWCSProjectParser(
const QString& filePath
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, const QgsAccessControl* as
#endif
)
#ifdef HAVE_SERVER_PYTHON_PLUGINS
:
mAccessControl( as )
#endif
: mAccessControl( as )
{
#ifndef HAVE_SERVER_PYTHON_PLUGINS
Q_UNUSED( mAccessControl );
#endif
mProjectParser = QgsConfigCache::instance()->serverConfiguration( filePath );
}

@@ -21,18 +21,14 @@
#include "qgsserverprojectparser.h"
#include "qgis_server.h"

#ifdef HAVE_SERVER_PYTHON_PLUGINS
class QgsAccessControl;
#endif

class SERVER_EXPORT QgsWCSProjectParser
{
public:
QgsWCSProjectParser(
const QString& filePath
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, const QgsAccessControl* ac
#endif
);
~QgsWCSProjectParser();

@@ -49,9 +45,7 @@ class SERVER_EXPORT QgsWCSProjectParser

private:
QgsServerProjectParser* mProjectParser;
#ifdef HAVE_SERVER_PYTHON_PLUGINS
const QgsAccessControl* mAccessControl;
#endif

};

@@ -26,15 +26,13 @@

QgsWfsProjectParser::QgsWfsProjectParser(
const QString& filePath
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, const QgsAccessControl* ac
#endif
)
#ifdef HAVE_SERVER_PYTHON_PLUGINS
:
mAccessControl( ac )
#endif
: mAccessControl( ac )
{
#ifndef HAVE_SERVER_PYTHON_PLUGINS
Q_UNUSED( mAccessControl );
#endif
mProjectParser = QgsConfigCache::instance()->serverConfiguration( filePath );
}

@@ -22,19 +22,15 @@
#include "qgis_server.h"


#ifdef HAVE_SERVER_PYTHON_PLUGINS
class QgsAccessControl;
#endif


class SERVER_EXPORT QgsWfsProjectParser
{
public:
QgsWfsProjectParser(
const QString& filePath
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, const QgsAccessControl* ac
#endif
);
~QgsWfsProjectParser();

@@ -60,9 +56,7 @@ class SERVER_EXPORT QgsWfsProjectParser

private:
QgsServerProjectParser* mProjectParser;
#ifdef HAVE_SERVER_PYTHON_PLUGINS
const QgsAccessControl* mAccessControl;
#endif

};

@@ -51,14 +51,10 @@

QgsWmsProjectParser::QgsWmsProjectParser(
const QString& filePath
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, const QgsAccessControl* accessControl
#endif
)
: QgsWmsConfigParser()
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, mAccessControl( accessControl )
#endif
{
mProjectParser = QgsConfigCache::instance()->serverConfiguration( filePath );
mLegendLayerFont.fromString( mProjectParser->firstComposerLegendElement().attribute( QStringLiteral( "layerFont" ) ) );
@@ -230,9 +226,7 @@ QList<QgsMapLayer*> QgsWmsProjectParser::mapLayerFromStyle( const QString& lName
QString project = mProjectParser->convertToAbsolutePath( legendIt->attribute( QStringLiteral( "project" ) ) );
QgsWmsProjectParser* p = dynamic_cast<QgsWmsProjectParser*>( QgsConfigCache::instance()->wmsConfiguration(
project
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, mAccessControl
#endif
) );
if ( p )
{
@@ -279,9 +273,7 @@ void QgsWmsProjectParser::addLayersFromGroup( const QDomElement& legendGroupElem
QString project = mProjectParser->convertToAbsolutePath( legendGroupElem.attribute( QStringLiteral( "project" ) ) );
QgsWmsProjectParser* p = dynamic_cast<QgsWmsProjectParser*>( QgsConfigCache::instance()->wmsConfiguration(
project
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, mAccessControl
#endif
) );
if ( p )
{
@@ -1198,9 +1190,7 @@ void QgsWmsProjectParser::addLayers( QDomDocument &doc,
QString embeddedGroupName = currentChildElem.attribute( QStringLiteral( "name" ) );
QgsWmsProjectParser* p = dynamic_cast<QgsWmsProjectParser*>( QgsConfigCache::instance()->wmsConfiguration(
project
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, mAccessControl
#endif
) );
if ( p )
{
@@ -1542,9 +1532,7 @@ void QgsWmsProjectParser::addOWSLayers( QDomDocument &doc,
QString embeddedGroupName = currentChildElem.attribute( QStringLiteral( "name" ) );
QgsWmsProjectParser* p = dynamic_cast<QgsWmsProjectParser*>( QgsConfigCache::instance()->wmsConfiguration(
project
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, mAccessControl
#endif
) );
if ( p )
{
@@ -23,9 +23,7 @@
#include "qgslayertreegroup.h"
#include "qgis_server.h"

#ifdef HAVE_SERVER_PYTHON_PLUGINS
class QgsAccessControl;
#endif

class QTextDocument;
class QSvgRenderer;
@@ -36,9 +34,7 @@ class SERVER_EXPORT QgsWmsProjectParser : public QgsWmsConfigParser
public:
QgsWmsProjectParser(
const QString& filePath
#ifdef HAVE_SERVER_PYTHON_PLUGINS
, const QgsAccessControl* accessControl
#endif
);
virtual ~QgsWmsProjectParser();

@@ -133,9 +129,7 @@ class SERVER_EXPORT QgsWmsProjectParser : public QgsWmsConfigParser

private:
QgsServerProjectParser* mProjectParser;
#ifdef HAVE_SERVER_PYTHON_PLUGINS
const QgsAccessControl* mAccessControl;
#endif

mutable QFont mLegendLayerFont;
mutable QFont mLegendItemFont;
@@ -44,9 +44,9 @@ namespace QgsWcs
QByteArray getCoverageData( QgsServerInterface* serverIface, const QgsServerRequest& request )
{
QgsWCSProjectParser* configParser = getConfigParser( serverIface );

#ifdef HAVE_SERVER_PYTHON_PLUGINS
QgsAccessControl* accessControl = serverIface->accessControls();

#endif
QStringList wcsLayersId = configParser->wcsLayers();

QList<QgsMapLayer*> layerList;
@@ -56,8 +56,9 @@ namespace QgsWfs
QDomDocument doc;

QgsWfsProjectParser* configParser = getConfigParser( serverIface );
#ifdef HAVE_SERVER_PYTHON_PLUGINS
QgsAccessControl* accessControl = serverIface->accessControls();

#endif
const QString requestBody = request.getParameter( QStringLiteral( "REQUEST_BODY" ) );

QString errorMsg;
@@ -16,8 +16,9 @@ SET (wms_SRCS
qgswmsgetschemaextension.cpp
qgswmsgetstyle.cpp
qgswmsgetstyles.cpp
qgswmsservertransitional.cpp
qgsmaprendererjobproxy.cpp
qgsmediancut.cpp
qgswmsrenderer.cpp
)

########################################################

0 comments on commit 53752ba

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