Skip to content
Permalink
Browse files
Small API cleanup in QgsMapSettings
  • Loading branch information
wonder-sk committed Jun 21, 2014
1 parent 37fd5b7 commit d2bc8fb
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 38 deletions.
@@ -62,22 +62,6 @@ class QgsMapSettings
//! Get color that is used for drawing of selected vector features
QColor selectionColor() const;

/**Sets whether vector selections should be shown in the rendered map
* @param showSelection set to true if selections should be shown
* @see showSelection
* @see setSelectionColor
* @note Added in QGIS v2.4
*/
void setShowSelection( const bool showSelection );

/**Returns true if vector selections should be shown in the rendered map
* @returns true if selections should be shown
* @see setShowSelection
* @see selectionColor
* @note Added in QGIS v2.4
*/
bool showSelection() const;

//! Enumeration of flags that adjust the way how map is rendered
enum Flag
{
@@ -87,6 +71,7 @@ class QgsMapSettings
UseAdvancedEffects, //!< Enable layer transparency and blending effects
DrawLabeling, //!< Enable drawing of labels on top of the map
UseRenderingOptimization, //!< Enable vector simplification and other rendering optimizations
DrawSelection, //!< Whether vector selections should be shown in the rendered map
// TODO: ignore scale-based visibility (overview)
};
typedef QFlags<QgsMapSettings::Flag> Flags;
@@ -185,7 +185,6 @@ void QgsComposerMap::draw( QPainter *painter, const QgsRectangle& extent, const
jobMapSettings.setOutputDpi( dpi );
jobMapSettings.setMapUnits( ms.mapUnits() );
jobMapSettings.setBackgroundColor( Qt::transparent );
jobMapSettings.setShowSelection( false );
jobMapSettings.setOutputImageFormat( ms.outputImageFormat() );

//set layers to render
@@ -203,6 +202,7 @@ void QgsComposerMap::draw( QPainter *painter, const QgsRectangle& extent, const
jobMapSettings.setDestinationCrs( ms.destinationCrs() );
jobMapSettings.setCrsTransformEnabled( ms.hasCrsTransformEnabled() );
jobMapSettings.setFlags( ms.flags() );
jobMapSettings.setFlag( QgsMapSettings::DrawSelection, false );

if ( mComposition->plotStyle() == QgsComposition::Print ||
mComposition->plotStyle() == QgsComposition::Postscript )
@@ -39,8 +39,7 @@ QgsMapSettings::QgsMapSettings()
, mDatumTransformStore( mDestCRS )
, mBackgroundColor( Qt::white )
, mSelectionColor( Qt::yellow )
, mShowSelection( true )
, mFlags( Antialiasing | UseAdvancedEffects | DrawLabeling )
, mFlags( Antialiasing | UseAdvancedEffects | DrawLabeling | DrawSelection )
, mImageFormat( QImage::Format_ARGB32_Premultiplied )
{
updateDerived();
@@ -108,22 +108,6 @@ class CORE_EXPORT QgsMapSettings
//! Get color that is used for drawing of selected vector features
QColor selectionColor() const { return mSelectionColor; }

/**Sets whether vector selections should be shown in the rendered map
* @param showSelection set to true if selections should be shown
* @see showSelection
* @see setSelectionColor
* @note Added in QGIS v2.4
*/
void setShowSelection( const bool showSelection ) { mShowSelection = showSelection; }

/**Returns true if vector selections should be shown in the rendered map
* @returns true if selections should be shown
* @see setShowSelection
* @see selectionColor
* @note Added in QGIS v2.4
*/
bool showSelection() const { return mShowSelection; }

//! Enumeration of flags that adjust the way how map is rendered
enum Flag
{
@@ -133,6 +117,7 @@ class CORE_EXPORT QgsMapSettings
UseAdvancedEffects = 0x08, //!< Enable layer transparency and blending effects
DrawLabeling = 0x10, //!< Enable drawing of labels on top of the map
UseRenderingOptimization = 0x20, //!< Enable vector simplification and other rendering optimizations
DrawSelection = 0x40, //!< Whether vector selections should be shown in the rendered map
// TODO: ignore scale-based visibility (overview)
};
Q_DECLARE_FLAGS( Flags, Flag )
@@ -240,8 +225,6 @@ class CORE_EXPORT QgsMapSettings

QColor mBackgroundColor;
QColor mSelectionColor;
/**Whether selection should be shown in the map*/
bool mShowSelection;

Flags mFlags;

@@ -52,7 +52,7 @@ QgsRenderContext QgsRenderContext::fromMapSettings( const QgsMapSettings& mapSet
ctx.setUseRenderingOptimization( mapSettings.testFlag( QgsMapSettings::UseRenderingOptimization ) );
ctx.setCoordinateTransform( 0 );
ctx.setSelectionColor( mapSettings.selectionColor() );
ctx.setShowSelection( mapSettings.showSelection() );
ctx.setShowSelection( mapSettings.testFlag( QgsMapSettings::DrawSelection ) );
ctx.setRasterScaleFactor( 1.0 );
ctx.setScaleFactor( mapSettings.outputDpi() / 25.4 ); // = pixels per mm
ctx.setRendererScale( mapSettings.scale() );

0 comments on commit d2bc8fb

Please sign in to comment.