Skip to content
Permalink
Browse files
[Server] Use Project selection color in GetPrint for 2.18
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 8ef047d4c54c943e03d82ef1c91fb496ec460b89
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
@@ -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 ||
@@ -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;
}

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.