Skip to content
Permalink
Browse files

[Server] GetLegendGraphics refactoring

  • Loading branch information
pblottiere committed Jun 9, 2017
1 parent f80a1f5 commit dae8447b0b1ddd8e2d28b0f70f9b665ca4f409ca
@@ -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 dae8447

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