Skip to content

Commit

Permalink
Small API cleanup in QgsMapSettings
Browse files Browse the repository at this point in the history
  • 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.
17 changes: 1 addition & 16 deletions python/core/qgsmapsettings.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposermap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 )
Expand Down
3 changes: 1 addition & 2 deletions src/core/qgsmapsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
19 changes: 1 addition & 18 deletions src/core/qgsmapsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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 )
Expand Down Expand Up @@ -240,8 +225,6 @@ class CORE_EXPORT QgsMapSettings

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

Flags mFlags;

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsrendercontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down

0 comments on commit d2bc8fb

Please sign in to comment.