@@ -42,6 +42,9 @@ QgsVectorLayerRenderer::QgsVectorLayerRenderer( QgsVectorLayer* layer, QgsRender
42
42
mLayerTransparency = layer->layerTransparency ();
43
43
mFeatureBlendMode = layer->featureBlendMode ();
44
44
45
+ mSimplifyMethod = layer->simplifyMethod ();
46
+ mSimplifyGeometry = layer->simplifyDrawingCanbeApplied ( mContext , QgsVectorLayer::GeometrySimplification );
47
+
45
48
QSettings settings;
46
49
mVertexMarkerOnlyForSelection = settings.value ( " /qgis/digitizing/marker_only_for_selected" , false ).toBool ();
47
50
@@ -114,21 +117,20 @@ bool QgsVectorLayerRenderer::render()
114
117
.setSubsetOfAttributes ( mAttrNames , mFields );
115
118
116
119
// enable the simplification of the geometries (Using the current map2pixel context) before send it to renderer engine.
117
- #if 0 //TODO[MD]: after merge
118
- if ( simplifyDrawingCanbeApplied( mContext, QgsVectorLayer::GeometrySimplification ) )
120
+ if ( mSimplifyGeometry )
119
121
{
120
- QPainter* p = rendererContext .painter();
122
+ QPainter* p = mContext .painter ();
121
123
double dpi = ( p->device ()->logicalDpiX () + p->device ()->logicalDpiY () ) / 2 ;
122
124
double map2pixelTol = mSimplifyMethod .threshold () * 96 .0f / dpi;
123
125
124
- const QgsMapToPixel& mtp = rendererContext .mapToPixel();
126
+ const QgsMapToPixel& mtp = mContext .mapToPixel ();
125
127
map2pixelTol *= mtp.mapUnitsPerPixel ();
126
- const QgsCoordinateTransform* ct = rendererContext .coordinateTransform();
128
+ const QgsCoordinateTransform* ct = mContext .coordinateTransform ();
127
129
128
130
// resize the tolerance using the change of size of an 1-BBOX from the source CoordinateSystem to the target CoordinateSystem
129
131
if ( ct && !(( QgsCoordinateTransform* )ct )->isShortCircuited () )
130
132
{
131
- QgsPoint center = rendererContext .extent().center();
133
+ QgsPoint center = mContext .extent ().center ();
132
134
double rectSize = ct->sourceCrs ().geographicFlag () ? 0.0008983 /* ~100/(40075014/360=111319.4833) */ : 100 ;
133
135
134
136
QgsRectangle sourceRect = QgsRectangle ( center.x (), center.y (), center.x () + rectSize, center.y () + rectSize );
@@ -153,7 +155,6 @@ bool QgsVectorLayerRenderer::render()
153
155
154
156
featureRequest.setSimplifyMethod ( simplifyMethod );
155
157
}
156
- #endif
157
158
158
159
QgsFeatureIterator fit = mSource ->getFeatures ( featureRequest );
159
160
0 commit comments