Skip to content

Commit 268b9ac

Browse files
rldhontnyalldawson
authored andcommittedJun 6, 2018
[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
1 parent 61262a2 commit 268b9ac

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed
 

‎src/core/composer/qgscomposermap.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ QgsComposerMap::QgsComposerMap( QgsComposition *composition, int x, int y, int w
5959
, mUpdatesEnabled( true )
6060
, mMapCanvas( nullptr )
6161
, mDrawCanvasItems( true )
62+
, mDrawSelection( false )
6263
, mAtlasDriven( false )
6364
, mAtlasScalingMode( Auto )
6465
, mAtlasMargin( 0.10 )
@@ -229,7 +230,7 @@ QgsMapSettings QgsComposerMap::mapSettings( const QgsRectangle& extent, QSizeF s
229230
jobMapSettings.setDestinationCrs( ms.destinationCrs() );
230231
jobMapSettings.setCrsTransformEnabled( ms.hasCrsTransformEnabled() );
231232
jobMapSettings.setFlags( ms.flags() );
232-
jobMapSettings.setFlag( QgsMapSettings::DrawSelection, false );
233+
jobMapSettings.setFlag( QgsMapSettings::DrawSelection, mDrawSelection );
233234
jobMapSettings.setFlag( QgsMapSettings::RenderPartialOutput, false );
234235

235236
if ( mComposition->plotStyle() == QgsComposition::Print ||

‎src/core/composer/qgscomposermap.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,17 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
639639
void setDrawCanvasItems( bool b ) { mDrawCanvasItems = b; }
640640
bool drawCanvasItems() const { return mDrawCanvasItems; }
641641

642+
/** Set the flag to draw selection in map
643+
* @note this function was added in version 2.18.21
644+
* @note not available in Python bindings
645+
*/
646+
void setDrawSelection( bool b ) { mDrawSelection = b; }
647+
/** Get the flag to draw selection in map
648+
* @note this function was added in version 2.18.21
649+
* @note not available in Python bindings
650+
*/
651+
bool drawSelection() const { return mDrawSelection; }
652+
642653
/** Returns the conversion factor map units -> mm*/
643654
double mapUnitsToMM() const;
644655

@@ -939,6 +950,9 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
939950
/** True if annotation items, rubber band, etc. from the main canvas should be displayed*/
940951
bool mDrawCanvasItems;
941952

953+
/** True if selection has to be drawn. For server only! */
954+
bool mDrawSelection;
955+
942956
/** Adjusts an extent rectangle to match the provided item width and height, so that extent
943957
* center of extent remains the same */
944958
void adjustExtentToItemShape( double itemWidth, double itemHeight, QgsRectangle& extent ) const;

‎src/server/qgswmsconfigparser.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@ QgsComposition* QgsWMSConfigParser::createPrintComposition( const QString& compo
279279
}
280280
}
281281

282+
// Draw Selection
283+
currentMap->setDrawSelection( true );
284+
282285
//grid space x / y
283286
currentMap->grid()->setIntervalX( parameterMap.value( mapId + ":GRID_INTERVAL_X" ).toDouble() );
284287
currentMap->grid()->setIntervalY( parameterMap.value( mapId + ":GRID_INTERVAL_Y" ).toDouble() );

0 commit comments

Comments
 (0)
Please sign in to comment.