diff --git a/src/core/composer/qgscomposermap.cpp b/src/core/composer/qgscomposermap.cpp index 3902e4f49494..60130d97c949 100644 --- a/src/core/composer/qgscomposermap.cpp +++ b/src/core/composer/qgscomposermap.cpp @@ -59,6 +59,7 @@ QgsComposerMap::QgsComposerMap( QgsComposition *composition, int x, int y, int w , mUpdatesEnabled( true ) , mMapCanvas( nullptr ) , mDrawCanvasItems( true ) + , mDrawSelection( false ) , mAtlasDriven( false ) , mAtlasScalingMode( Auto ) , mAtlasMargin( 0.10 ) @@ -229,7 +230,7 @@ QgsMapSettings QgsComposerMap::mapSettings( const QgsRectangle& extent, QSizeF s jobMapSettings.setDestinationCrs( ms.destinationCrs() ); jobMapSettings.setCrsTransformEnabled( ms.hasCrsTransformEnabled() ); jobMapSettings.setFlags( ms.flags() ); - jobMapSettings.setFlag( QgsMapSettings::DrawSelection, false ); + jobMapSettings.setFlag( QgsMapSettings::DrawSelection, mDrawSelection ); jobMapSettings.setFlag( QgsMapSettings::RenderPartialOutput, false ); if ( mComposition->plotStyle() == QgsComposition::Print || diff --git a/src/core/composer/qgscomposermap.h b/src/core/composer/qgscomposermap.h index 8ec35ccdf981..b52c621cd02a 100644 --- a/src/core/composer/qgscomposermap.h +++ b/src/core/composer/qgscomposermap.h @@ -639,6 +639,17 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem void setDrawCanvasItems( bool b ) { mDrawCanvasItems = b; } bool drawCanvasItems() const { return mDrawCanvasItems; } + /** Set the flag to draw selection in map + * @note this function was added in version 2.18.21 + * @note not available in Python bindings + */ + void setDrawSelection( bool b ) { mDrawSelection = b; } + /** Get the flag to draw selection in map + * @note this function was added in version 2.18.21 + * @note not available in Python bindings + */ + bool drawSelection() const { return mDrawSelection; } + /** Returns the conversion factor map units -> mm*/ double mapUnitsToMM() const; @@ -939,6 +950,9 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem /** True if annotation items, rubber band, etc. from the main canvas should be displayed*/ bool mDrawCanvasItems; + /** True if selection has to be drawn. For server only! */ + bool mDrawSelection; + /** Adjusts an extent rectangle to match the provided item width and height, so that extent * center of extent remains the same */ void adjustExtentToItemShape( double itemWidth, double itemHeight, QgsRectangle& extent ) const; diff --git a/src/server/qgswmsconfigparser.cpp b/src/server/qgswmsconfigparser.cpp index 342f593d461e..2ea51e4a196f 100644 --- a/src/server/qgswmsconfigparser.cpp +++ b/src/server/qgswmsconfigparser.cpp @@ -279,6 +279,9 @@ QgsComposition* QgsWMSConfigParser::createPrintComposition( const QString& compo } } + // Draw Selection + currentMap->setDrawSelection( true ); + //grid space x / y currentMap->grid()->setIntervalX( parameterMap.value( mapId + ":GRID_INTERVAL_X" ).toDouble() ); currentMap->grid()->setIntervalY( parameterMap.value( mapId + ":GRID_INTERVAL_Y" ).toDouble() );