Skip to content
Permalink
Browse files

[Server] Reactivate the capability to print selection with Server 2.18

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
  • Loading branch information
rldhont authored and nyalldawson committed Jun 6, 2018
1 parent 61262a2 commit 268b9ac6ec98ef75c41959a7085ab415ba2e1c38
Showing with 19 additions and 1 deletion.
  1. +2 −1 src/core/composer/qgscomposermap.cpp
  2. +14 −0 src/core/composer/qgscomposermap.h
  3. +3 −0 src/server/qgswmsconfigparser.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 ||
@@ -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;
@@ -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() );

0 comments on commit 268b9ac

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