Skip to content

Commit 0a970eb

Browse files
ahuarte47m-kuhn
authored andcommitted
#8725-R: define UseRenderingOptimization
Redefine RenderingPrintComposition to UseRenderingOptimization
1 parent 10db577 commit 0a970eb

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/core/composer/qgscomposermap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ void QgsComposerMap::draw( QPainter *painter, const QgsRectangle& extent, const
208208
mComposition->plotStyle() == QgsComposition::Postscript )
209209
{
210210
//if outputing composer, disable optimisations like layer simplification
211-
theRendererContext->setRenderingPrintComposition( true );
211+
theRendererContext->setUseRenderingOptimization( false );
212212
}
213213

214214
// force vector output (no caching of marker images etc.)

src/core/qgsrendercontext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ QgsRenderContext::QgsRenderContext()
2929
mRasterScaleFactor( 1.0 ),
3030
mRendererScale( 1.0 ),
3131
mLabelingEngine( NULL ),
32-
mRenderingPrintComposition( false )
32+
mUseRenderingOptimization( true )
3333
{
3434

3535
}

src/core/qgsrendercontext.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ class CORE_EXPORT QgsRenderContext
9595
//! Added in QGIS v2.0
9696
void setSelectionColor( const QColor& color ) { mSelectionColor = color; }
9797

98-
/**True if the rendering request comes from a print composition, false it comes from a normal window request */
99-
void setRenderingPrintComposition( bool renderingPrintComposition ) { mRenderingPrintComposition = renderingPrintComposition; }
100-
bool renderingPrintComposition( ) const { return mRenderingPrintComposition; }
98+
/**Returns true if the rendering optimization (geometry simplification) can be executed*/
99+
bool useRenderingOptimization() const { return mUseRenderingOptimization; }
100+
void setUseRenderingOptimization( bool enabled ) { mUseRenderingOptimization = enabled; }
101101

102102
private:
103103

@@ -138,8 +138,8 @@ class CORE_EXPORT QgsRenderContext
138138
/** Color used for features that are marked as selected */
139139
QColor mSelectionColor;
140140

141-
/**True if the rendering request comes from a print composition, false it comes from a normal window request */
142-
bool mRenderingPrintComposition;
141+
/**True if the rendering optimization (geometry simplification) can be executed*/
142+
bool mUseRenderingOptimization;
143143
};
144144

145145
#endif

src/core/qgsvectorlayer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
705705
QgsFeatureIterator fit = QgsFeatureIterator();
706706

707707
// Enable the simplification of the geometries (Using the current map2pixel context) before fetch the features.
708-
if ( simplifyDrawingCanbeApplied( QgsVectorLayer::GeometrySimplification | QgsVectorLayer::EnvelopeSimplification ) && !( featureRequest.flags() & QgsFeatureRequest::NoGeometry ) && !rendererContext.renderingPrintComposition() )
708+
if ( simplifyDrawingCanbeApplied( QgsVectorLayer::GeometrySimplification | QgsVectorLayer::EnvelopeSimplification ) && !( featureRequest.flags() & QgsFeatureRequest::NoGeometry ) )
709709
{
710710
QPainter* p = rendererContext.painter();
711711
float dpi = ( p->device()->logicalDpiX() + p->device()->logicalDpiY() ) / 2;
@@ -1250,7 +1250,7 @@ bool QgsVectorLayer::setSubsetString( QString subset )
12501250

12511251
bool QgsVectorLayer::simplifyDrawingCanbeApplied( int simplifyHint ) const
12521252
{
1253-
return mDataProvider && ( mSimplifyDrawingHints & simplifyHint ) && !mEditBuffer && ( !mCurrentRendererContext || !mCurrentRendererContext->renderingPrintComposition() );
1253+
return mDataProvider && ( mSimplifyDrawingHints & simplifyHint ) && !mEditBuffer && ( !mCurrentRendererContext || mCurrentRendererContext->useRenderingOptimization() );
12541254
}
12551255

12561256
QgsFeatureIterator QgsVectorLayer::getFeatures( const QgsFeatureRequest& request )

0 commit comments

Comments
 (0)