@@ -135,6 +135,7 @@ bool QgsVectorLayerRenderer::render()
135
135
if ( mSimplifyGeometry )
136
136
{
137
137
double map2pixelTol = mSimplifyMethod .threshold ();
138
+ bool validTransform = true ;
138
139
139
140
const QgsMapToPixel& mtp = mContext .mapToPixel ();
140
141
map2pixelTol *= mtp.mapUnitsPerPixel ();
@@ -174,18 +175,28 @@ bool QgsVectorLayerRenderer::render()
174
175
catch ( QgsCsException &cse )
175
176
{
176
177
QgsMessageLog::logMessage ( QObject::tr ( " Simplify transform error caught: %1" ).arg ( cse.what () ), QObject::tr ( " CRS" ) );
178
+ validTransform = false ;
177
179
}
178
180
}
179
181
180
- QgsSimplifyMethod simplifyMethod;
181
- simplifyMethod.setMethodType ( QgsSimplifyMethod::OptimizeForRendering );
182
- simplifyMethod.setTolerance ( map2pixelTol );
183
- simplifyMethod.setForceLocalOptimization ( mSimplifyMethod .forceLocalOptimization () );
182
+ if ( validTransform )
183
+ {
184
+ QgsSimplifyMethod simplifyMethod;
185
+ simplifyMethod.setMethodType ( QgsSimplifyMethod::OptimizeForRendering );
186
+ simplifyMethod.setTolerance ( map2pixelTol );
187
+ simplifyMethod.setForceLocalOptimization ( mSimplifyMethod .forceLocalOptimization () );
184
188
185
- featureRequest.setSimplifyMethod ( simplifyMethod );
189
+ featureRequest.setSimplifyMethod ( simplifyMethod );
186
190
187
- QgsVectorSimplifyMethod vectorMethod = mSimplifyMethod ;
188
- mContext .setVectorSimplifyMethod ( vectorMethod );
191
+ QgsVectorSimplifyMethod vectorMethod = mSimplifyMethod ;
192
+ mContext .setVectorSimplifyMethod ( vectorMethod );
193
+ }
194
+ else
195
+ {
196
+ QgsVectorSimplifyMethod vectorMethod;
197
+ vectorMethod.setSimplifyHints ( QgsVectorSimplifyMethod::NoSimplification );
198
+ mContext .setVectorSimplifyMethod ( vectorMethod );
199
+ }
189
200
}
190
201
else
191
202
{
0 commit comments