Skip to content
Permalink
Browse files

Merge pull request #4699 from pblottiere/getlegendgraphic

[Server] WMS GetLegendGraphics refactoring
  • Loading branch information
rldhont committed Jun 12, 2017
2 parents 492ad2d + 7b84483 commit faa7c750bc57c825f39799dc5826a9b6a15ab679
Showing with 1,681 additions and 506 deletions.
  1. +3 −11 src/server/services/wms/qgslayerrestorer.cpp
  2. +1 −0 src/server/services/wms/qgslayerrestorer.h
  3. +510 −14 src/server/services/wms/qgswmsparameters.cpp
  4. +325 −6 src/server/services/wms/qgswmsparameters.h
  5. +186 −463 src/server/services/wms/qgswmsrenderer.cpp
  6. +9 −11 src/server/services/wms/qgswmsrenderer.h
  7. +4 −1 tests/src/python/test_qgsserver.py
  8. +198 −0 tests/src/python/test_qgsserver_wms.py
  9. BIN ...stdata/control_images/qgis_server/WMS_GetLegendGraphic_ItemFont/WMS_GetLegendGraphic_ItemFont.png
  10. BIN ...a/control_images/qgis_server/WMS_GetLegendGraphic_ItemFont/WMS_GetLegendGraphic_ItemFont_mask.png
  11. BIN ...data/control_images/qgis_server/WMS_GetLegendGraphic_LayerFont/WMS_GetLegendGraphic_LayerFont.png
  12. BIN ...control_images/qgis_server/WMS_GetLegendGraphic_LayerFont/WMS_GetLegendGraphic_LayerFont_mask.png
  13. BIN ...ta/control_images/qgis_server/WMS_GetLegendGraphic_LayerSpace/WMS_GetLegendGraphic_LayerSpace.png
  14. BIN ...ntrol_images/qgis_server/WMS_GetLegendGraphic_LayerSpace/WMS_GetLegendGraphic_LayerSpace_mask.png
  15. BIN ...mages/qgis_server/WMS_GetLegendGraphic_ShowFeatureCount/WMS_GetLegendGraphic_ShowFeatureCount.png
  16. BIN .../qgis_server/WMS_GetLegendGraphic_ShowFeatureCount/WMS_GetLegendGraphic_ShowFeatureCount_mask.png
  17. BIN tests/testdata/control_images/qgis_server/WMS_GetLegendGraphic_rule0/WMS_GetLegendGraphic_rule0.png
  18. BIN tests/testdata/control_images/qgis_server/WMS_GetLegendGraphic_rule1/WMS_GetLegendGraphic_rule1.png
  19. BIN ..._images/qgis_server/WMS_GetLegendGraphic_rulelabel_false/WMS_GetLegendGraphic_rulelabel_false.png
  20. BIN ...es/qgis_server/WMS_GetLegendGraphic_rulelabel_false/WMS_GetLegendGraphic_rulelabel_false_mask.png
  21. BIN tests/testdata/control_images/qgis_server/WMS_GetLegendGraphic_test/WMS_GetLegendGraphic_test.png
  22. BIN .../testdata/control_images/qgis_server/WMS_GetLegendGraphic_test/WMS_GetLegendGraphic_test_mask.png
  23. BIN ...l_images/qgis_server_accesscontrol/WMS_GetLegendGraphic_Hello/WMS_GetLegendGraphic_Hello_mask.png
  24. +445 −0 tests/testdata/qgis_server/test_project_legend_rule.qgs
@@ -21,24 +21,15 @@
#include "qgsrasterrenderer.h"
#include "qgsmaplayerstylemanager.h"

const QString DEFAULT_NAMED_STYLE = "server_default_style";

QgsLayerRestorer::QgsLayerRestorer( const QList<QgsMapLayer *> &layers )
{
Q_FOREACH ( QgsMapLayer *layer, layers )
{
QgsLayerSettings settings;
settings.name = layer->name();

QString style = layer->styleManager()->currentStyle();
if ( style.isEmpty() )
{
layer->styleManager()->addStyleFromLayer( DEFAULT_NAMED_STYLE );
settings.mNamedStyle = DEFAULT_NAMED_STYLE;
}
else
{
settings.mNamedStyle = style;
}
settings.mNamedStyle = layer->styleManager()->currentStyle();

// set a custom property allowing to keep in memory if a SLD file has
// been loaded for rendering
@@ -80,6 +71,7 @@ QgsLayerRestorer::~QgsLayerRestorer()
{
QgsLayerSettings settings = mLayerSettings[layer];
layer->styleManager()->setCurrentStyle( settings.mNamedStyle );
layer->setName( mLayerSettings[layer].name );

// if a SLD file has been loaded for rendering, we restore the previous one
QString errMsg;
@@ -30,6 +30,7 @@ class QgsLayerRestorer
{
struct QgsLayerSettings
{
QString name;
double mOpacity;
QString mNamedStyle;
QDomDocument mSldStyle;

0 comments on commit faa7c75

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