Skip to content

Commit d2bc8fb

Browse files
committedJun 21, 2014
Small API cleanup in QgsMapSettings
1 parent 37fd5b7 commit d2bc8fb

File tree

5 files changed

+5
-38
lines changed

5 files changed

+5
-38
lines changed
 

‎python/core/qgsmapsettings.sip

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,6 @@ class QgsMapSettings
6262
//! Get color that is used for drawing of selected vector features
6363
QColor selectionColor() const;
6464

65-
/**Sets whether vector selections should be shown in the rendered map
66-
* @param showSelection set to true if selections should be shown
67-
* @see showSelection
68-
* @see setSelectionColor
69-
* @note Added in QGIS v2.4
70-
*/
71-
void setShowSelection( const bool showSelection );
72-
73-
/**Returns true if vector selections should be shown in the rendered map
74-
* @returns true if selections should be shown
75-
* @see setShowSelection
76-
* @see selectionColor
77-
* @note Added in QGIS v2.4
78-
*/
79-
bool showSelection() const;
80-
8165
//! Enumeration of flags that adjust the way how map is rendered
8266
enum Flag
8367
{
@@ -87,6 +71,7 @@ class QgsMapSettings
8771
UseAdvancedEffects, //!< Enable layer transparency and blending effects
8872
DrawLabeling, //!< Enable drawing of labels on top of the map
8973
UseRenderingOptimization, //!< Enable vector simplification and other rendering optimizations
74+
DrawSelection, //!< Whether vector selections should be shown in the rendered map
9075
// TODO: ignore scale-based visibility (overview)
9176
};
9277
typedef QFlags<QgsMapSettings::Flag> Flags;

‎src/core/composer/qgscomposermap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ void QgsComposerMap::draw( QPainter *painter, const QgsRectangle& extent, const
185185
jobMapSettings.setOutputDpi( dpi );
186186
jobMapSettings.setMapUnits( ms.mapUnits() );
187187
jobMapSettings.setBackgroundColor( Qt::transparent );
188-
jobMapSettings.setShowSelection( false );
189188
jobMapSettings.setOutputImageFormat( ms.outputImageFormat() );
190189

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

207207
if ( mComposition->plotStyle() == QgsComposition::Print ||
208208
mComposition->plotStyle() == QgsComposition::Postscript )

‎src/core/qgsmapsettings.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ QgsMapSettings::QgsMapSettings()
3939
, mDatumTransformStore( mDestCRS )
4040
, mBackgroundColor( Qt::white )
4141
, mSelectionColor( Qt::yellow )
42-
, mShowSelection( true )
43-
, mFlags( Antialiasing | UseAdvancedEffects | DrawLabeling )
42+
, mFlags( Antialiasing | UseAdvancedEffects | DrawLabeling | DrawSelection )
4443
, mImageFormat( QImage::Format_ARGB32_Premultiplied )
4544
{
4645
updateDerived();

‎src/core/qgsmapsettings.h

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,6 @@ class CORE_EXPORT QgsMapSettings
108108
//! Get color that is used for drawing of selected vector features
109109
QColor selectionColor() const { return mSelectionColor; }
110110

111-
/**Sets whether vector selections should be shown in the rendered map
112-
* @param showSelection set to true if selections should be shown
113-
* @see showSelection
114-
* @see setSelectionColor
115-
* @note Added in QGIS v2.4
116-
*/
117-
void setShowSelection( const bool showSelection ) { mShowSelection = showSelection; }
118-
119-
/**Returns true if vector selections should be shown in the rendered map
120-
* @returns true if selections should be shown
121-
* @see setShowSelection
122-
* @see selectionColor
123-
* @note Added in QGIS v2.4
124-
*/
125-
bool showSelection() const { return mShowSelection; }
126-
127111
//! Enumeration of flags that adjust the way how map is rendered
128112
enum Flag
129113
{
@@ -133,6 +117,7 @@ class CORE_EXPORT QgsMapSettings
133117
UseAdvancedEffects = 0x08, //!< Enable layer transparency and blending effects
134118
DrawLabeling = 0x10, //!< Enable drawing of labels on top of the map
135119
UseRenderingOptimization = 0x20, //!< Enable vector simplification and other rendering optimizations
120+
DrawSelection = 0x40, //!< Whether vector selections should be shown in the rendered map
136121
// TODO: ignore scale-based visibility (overview)
137122
};
138123
Q_DECLARE_FLAGS( Flags, Flag )
@@ -240,8 +225,6 @@ class CORE_EXPORT QgsMapSettings
240225

241226
QColor mBackgroundColor;
242227
QColor mSelectionColor;
243-
/**Whether selection should be shown in the map*/
244-
bool mShowSelection;
245228

246229
Flags mFlags;
247230

‎src/core/qgsrendercontext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ QgsRenderContext QgsRenderContext::fromMapSettings( const QgsMapSettings& mapSet
5252
ctx.setUseRenderingOptimization( mapSettings.testFlag( QgsMapSettings::UseRenderingOptimization ) );
5353
ctx.setCoordinateTransform( 0 );
5454
ctx.setSelectionColor( mapSettings.selectionColor() );
55-
ctx.setShowSelection( mapSettings.showSelection() );
55+
ctx.setShowSelection( mapSettings.testFlag( QgsMapSettings::DrawSelection ) );
5656
ctx.setRasterScaleFactor( 1.0 );
5757
ctx.setScaleFactor( mapSettings.outputDpi() / 25.4 ); // = pixels per mm
5858
ctx.setRendererScale( mapSettings.scale() );

0 commit comments

Comments
 (0)
Please sign in to comment.