Skip to content
Permalink
Browse files

#8725-R: define UseRenderingOptimization

Redefine RenderingPrintComposition to UseRenderingOptimization
  • Loading branch information
ahuarte47 authored and m-kuhn committed Jan 15, 2014
1 parent 10db577 commit 0a970eb7c35d5cce8b6d8422c413724d2e54b2ff
@@ -208,7 +208,7 @@ void QgsComposerMap::draw( QPainter *painter, const QgsRectangle& extent, const
mComposition->plotStyle() == QgsComposition::Postscript )
{
//if outputing composer, disable optimisations like layer simplification
theRendererContext->setRenderingPrintComposition( true );
theRendererContext->setUseRenderingOptimization( false );
}

// force vector output (no caching of marker images etc.)
@@ -29,7 +29,7 @@ QgsRenderContext::QgsRenderContext()
mRasterScaleFactor( 1.0 ),
mRendererScale( 1.0 ),
mLabelingEngine( NULL ),
mRenderingPrintComposition( false )
mUseRenderingOptimization( true )
{

}
@@ -95,9 +95,9 @@ class CORE_EXPORT QgsRenderContext
//! Added in QGIS v2.0
void setSelectionColor( const QColor& color ) { mSelectionColor = color; }

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

private:

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

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

#endif
@@ -705,7 +705,7 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
QgsFeatureIterator fit = QgsFeatureIterator();

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

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

QgsFeatureIterator QgsVectorLayer::getFeatures( const QgsFeatureRequest& request )

0 comments on commit 0a970eb

Please sign in to comment.
You can’t perform that action at this time.