Skip to content
Permalink
Browse files

#11243: Disable simplification when OTFR transform fails

  • Loading branch information
ahuarte47 committed Oct 7, 2014
1 parent e5850f3 commit 20b0d121c851d8ddfc7eb75c6793055755259884
Showing with 18 additions and 7 deletions.
  1. +18 −7 src/core/qgsvectorlayerrenderer.cpp
@@ -135,6 +135,7 @@ bool QgsVectorLayerRenderer::render()
if ( mSimplifyGeometry )
{
double map2pixelTol = mSimplifyMethod.threshold();
bool validTransform = true;

const QgsMapToPixel& mtp = mContext.mapToPixel();
map2pixelTol *= mtp.mapUnitsPerPixel();
@@ -174,18 +175,28 @@ bool QgsVectorLayerRenderer::render()
catch ( QgsCsException &cse )
{
QgsMessageLog::logMessage( QObject::tr( "Simplify transform error caught: %1" ).arg( cse.what() ), QObject::tr( "CRS" ) );
validTransform = false;
}
}

QgsSimplifyMethod simplifyMethod;
simplifyMethod.setMethodType( QgsSimplifyMethod::OptimizeForRendering );
simplifyMethod.setTolerance( map2pixelTol );
simplifyMethod.setForceLocalOptimization( mSimplifyMethod.forceLocalOptimization() );
if ( validTransform )
{
QgsSimplifyMethod simplifyMethod;
simplifyMethod.setMethodType( QgsSimplifyMethod::OptimizeForRendering );
simplifyMethod.setTolerance( map2pixelTol );
simplifyMethod.setForceLocalOptimization( mSimplifyMethod.forceLocalOptimization() );

featureRequest.setSimplifyMethod( simplifyMethod );
featureRequest.setSimplifyMethod( simplifyMethod );

QgsVectorSimplifyMethod vectorMethod = mSimplifyMethod;
mContext.setVectorSimplifyMethod( vectorMethod );
QgsVectorSimplifyMethod vectorMethod = mSimplifyMethod;
mContext.setVectorSimplifyMethod( vectorMethod );
}
else
{
QgsVectorSimplifyMethod vectorMethod;
vectorMethod.setSimplifyHints( QgsVectorSimplifyMethod::NoSimplification );
mContext.setVectorSimplifyMethod( vectorMethod );
}
}
else
{

0 comments on commit 20b0d12

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