Skip to content
Permalink
Browse files

Merge pull request #1616 from ahuarte47/Issue_11243

Fix #11243: Data corruption with feature simplification
  • Loading branch information
jef-n committed Oct 21, 2014
2 parents 42d915e + 20b0d12 commit 697ebffe4dd360824dca5ffdf7c8a8304c11ad06
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 697ebff

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