Skip to content

Commit

Permalink
[Server] Use Project selection color in GetPrint for 2.18
Browse files Browse the repository at this point in the history
QGIS Server uses QgsMapRenderer and not QgsMapSettings to configure maps
rendering, and color selection was not transmitted between QgsMapRenderer and
QgsMapSettings and between mapSettings and jobMapSettings in QgsMapComposer.

This commit completes:
* [Server] Reactivate the capability to print selection with Server 2.18 3d0f1b6
* [Server] Read and activate selection color 79a212e
  • Loading branch information
rldhont authored and nyalldawson committed Jun 21, 2018
1 parent 9f01039 commit 8ef047d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/composer/qgscomposermap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ QgsMapSettings QgsComposerMap::mapSettings( const QgsRectangle& extent, QSizeF s
jobMapSettings.setCrsTransformEnabled( ms.hasCrsTransformEnabled() );
jobMapSettings.setFlags( ms.flags() );
jobMapSettings.setFlag( QgsMapSettings::DrawSelection, mDrawSelection );
jobMapSettings.setSelectionColor( ms.selectionColor() );
jobMapSettings.setFlag( QgsMapSettings::RenderPartialOutput, false );

if ( mComposition->plotStyle() == QgsComposition::Print ||
Expand Down
9 changes: 9 additions & 0 deletions src/core/qgsmaprenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,15 @@ const QgsMapSettings& QgsMapRenderer::mapSettings()
mMapSettings.setCrsTransformEnabled( hasCrsTransformEnabled() );
mMapSettings.setDestinationCrs( destinationCrs() );
mMapSettings.setMapUnits( mapUnits() );

// set selection color
QgsProject* prj = QgsProject::instance();
int myRed = prj->readNumEntry( "Gui", "/SelectionColorRedPart", 255 );
int myGreen = prj->readNumEntry( "Gui", "/SelectionColorGreenPart", 255 );
int myBlue = prj->readNumEntry( "Gui", "/SelectionColorBluePart", 0 );
int myAlpha = prj->readNumEntry( "Gui", "/SelectionColorAlphaPart", 255 );
mMapSettings.setSelectionColor( QColor( myRed, myGreen, myBlue, myAlpha ) );

return mMapSettings;
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8ef047d

Please sign in to comment.