Skip to content
Permalink
Browse files

Add layer opacity to GetProjectSettings

  • Loading branch information
mhugent committed Jan 17, 2020
1 parent 18a7cd0 commit a6843879bc7d0bfd3b449cbe123579b4725fb60a
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/server/services/wms/qgswmsgetcapabilities.cpp
@@ -37,7 +37,8 @@
#include "qgsexpressionnodeimpl.h"
#include "qgsvectorlayer.h"
#include "qgsrasterdataprovider.h"

#include "qgsrasterlayer.h"
#include "qgsrasterrenderer.h"
#include "qgsvectorlayerserverproperties.h"


@@ -1901,6 +1902,9 @@ namespace QgsWms
//geometry type
layerElem.setAttribute( QStringLiteral( "geometryType" ), QgsWkbTypes::displayString( vLayer->wkbType() ) );

//opacity
layerElem.setAttribute( QStringLiteral( "opacity" ), QString::number( vLayer->opacity() ) );

layerElem.appendChild( attributesElem );
break;
}
@@ -1940,6 +1944,14 @@ namespace QgsWms
wmsPrintLayerElem.appendChild( wmsPrintLayerText );
layerElem.appendChild( wmsPrintLayerElem );
}

//opacity
QgsRasterLayer *rl = static_cast<QgsRasterLayer *>( currentLayer );
QgsRasterRenderer *rasterRenderer = rl->renderer();
if ( rasterRenderer )
{
layerElem.setAttribute( QStringLiteral( "opacity" ), QString::number( rasterRenderer->opacity() ) );
}
break;
}

0 comments on commit a684387

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