Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Server] Reactivate the capability to print selection with Server 3.4
The capability to print selection has been removed by the commit aaa7003 to
prevent accidental selections showing in exports from composer.

It is reactivated only for QGIS Server.

Fixes #13459 QGIS Server WMS GetPrint request don't respect SELECTION parameter

It's a forward porting of #7185
  • Loading branch information
rldhont committed Oct 25, 2018
1 parent 3ff5c82 commit 74f2785
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
Expand Up @@ -29,6 +29,7 @@ Stores information relating to the current rendering settings for a layout.
FlagUseAdvancedEffects,
FlagForceVectorOutput,
FlagHideCoverageLayer,
FlagDrawSelection,
};
typedef QFlags<QgsLayoutRenderContext::Flag> Flags;

Expand Down
2 changes: 1 addition & 1 deletion src/core/layout/qgslayoutitemmap.cpp
Expand Up @@ -1104,7 +1104,7 @@ QgsMapSettings QgsLayoutItemMap::mapSettings( const QgsRectangle &extent, QSizeF
jobMapSettings.setFlag( QgsMapSettings::ForceVectorOutput, true ); // force vector output (no caching of marker images etc.)
jobMapSettings.setFlag( QgsMapSettings::Antialiasing, mLayout->renderContext().flags() & QgsLayoutRenderContext::FlagAntialiasing );
jobMapSettings.setFlag( QgsMapSettings::DrawEditingInfo, false );
jobMapSettings.setFlag( QgsMapSettings::DrawSelection, false );
jobMapSettings.setFlag( QgsMapSettings::DrawSelection, mLayout->renderContext().flags() & QgsLayoutRenderContext::FlagDrawSelection );
jobMapSettings.setFlag( QgsMapSettings::UseAdvancedEffects, mLayout->renderContext().flags() & QgsLayoutRenderContext::FlagUseAdvancedEffects );
jobMapSettings.setTransformContext( mLayout->project()->transformContext() );
jobMapSettings.setPathResolver( mLayout->project()->pathResolver() );
Expand Down
1 change: 1 addition & 0 deletions src/core/layout/qgslayoutrendercontext.h
Expand Up @@ -45,6 +45,7 @@ class CORE_EXPORT QgsLayoutRenderContext : public QObject
FlagUseAdvancedEffects = 1 << 4, //!< Enable advanced effects such as blend modes.
FlagForceVectorOutput = 1 << 5, //!< Force output in vector format where possible, even if items require rasterization to keep their correct appearance.
FlagHideCoverageLayer = 1 << 6, //!< Hide coverage layer in outputs
FlagDrawSelection = 1 << 7, //!< Draw selection
};
Q_DECLARE_FLAGS( Flags, Flag )

Expand Down
4 changes: 2 additions & 2 deletions src/server/services/wms/qgswmsrenderer.cpp
Expand Up @@ -66,7 +66,6 @@
#include "qgslayerrestorer.h"
#include "qgsdxfexport.h"
#include "qgssymbollayerutils.h"
#include "qgslayoutitemlegend.h"
#include "qgsserverexception.h"

#include <QImage>
Expand All @@ -80,6 +79,7 @@
#include "qgslayoutmanager.h"
#include "qgslayoutexporter.h"
#include "qgslayoutsize.h"
#include "qgslayoutrendercontext.h"
#include "qgslayoutmeasurement.h"
#include "qgsprintlayout.h"
#include "qgslayoutpagecollection.h"
Expand Down Expand Up @@ -450,7 +450,7 @@ namespace QgsWms

bool QgsRenderer::configurePrintLayout( QgsPrintLayout *c, const QgsMapSettings &mapSettings )
{

c->renderContext().setFlag( QgsLayoutRenderContext::FlagDrawSelection, true );
// Maps are configured first
QList<QgsLayoutItemMap *> maps;
c->layoutItems<QgsLayoutItemMap>( maps );
Expand Down

0 comments on commit 74f2785

Please sign in to comment.