@@ -25,27 +25,6 @@ QgsAbstractFeatureIterator::QgsAbstractFeatureIterator( const QgsFeatureRequest&
25
25
, refs( 0 )
26
26
, mGeometrySimplifier( NULL )
27
27
{
28
- const QgsSimplifyMethod& simplifyMethod = request.simplifyMethod ();
29
-
30
- if ( simplifyMethod.methodType () != QgsSimplifyMethod::NoSimplification && simplifyMethod.forceLocalOptimization () )
31
- {
32
- QgsSimplifyMethod::MethodType methodType = simplifyMethod.methodType ();
33
-
34
- if ( methodType == QgsSimplifyMethod::OptimizeForRendering )
35
- {
36
- int simplifyFlags = QgsMapToPixelSimplifier::SimplifyGeometry | QgsMapToPixelSimplifier::SimplifyEnvelope;
37
- mGeometrySimplifier = new QgsMapToPixelSimplifier ( simplifyFlags, simplifyMethod.tolerance () );
38
- }
39
- else
40
- if ( methodType == QgsSimplifyMethod::PreserveTopology )
41
- {
42
- mGeometrySimplifier = new QgsTopologyPreservingSimplifier ( simplifyMethod.tolerance () );
43
- }
44
- else
45
- {
46
- QgsDebugMsg ( QString ( " Simplification method type (%1) is not recognised" ).arg ( methodType ) );
47
- }
48
- }
49
28
}
50
29
51
30
QgsAbstractFeatureIterator::~QgsAbstractFeatureIterator ()
@@ -122,6 +101,41 @@ void QgsAbstractFeatureIterator::deref()
122
101
delete this ;
123
102
}
124
103
104
+ bool QgsAbstractFeatureIterator::prepareLocalSimplification ()
105
+ {
106
+ const QgsSimplifyMethod& simplifyMethod = mRequest .simplifyMethod ();
107
+
108
+ if ( mGeometrySimplifier )
109
+ {
110
+ delete mGeometrySimplifier ;
111
+ mGeometrySimplifier = NULL ;
112
+ }
113
+
114
+ // setup the local simplification of geometries to fetch, it uses the settings of current FeatureRequest
115
+ if ( simplifyMethod.methodType () != QgsSimplifyMethod::NoSimplification && simplifyMethod.forceLocalOptimization () && !( mRequest .flags () & QgsFeatureRequest::NoGeometry ) )
116
+ {
117
+ QgsSimplifyMethod::MethodType methodType = simplifyMethod.methodType ();
118
+
119
+ if ( methodType == QgsSimplifyMethod::OptimizeForRendering )
120
+ {
121
+ int simplifyFlags = QgsMapToPixelSimplifier::SimplifyGeometry | QgsMapToPixelSimplifier::SimplifyEnvelope;
122
+ mGeometrySimplifier = new QgsMapToPixelSimplifier ( simplifyFlags, simplifyMethod.tolerance () );
123
+ return true ;
124
+ }
125
+ else
126
+ if ( methodType == QgsSimplifyMethod::PreserveTopology )
127
+ {
128
+ mGeometrySimplifier = new QgsTopologyPreservingSimplifier ( simplifyMethod.tolerance () );
129
+ return true ;
130
+ }
131
+ else
132
+ {
133
+ QgsDebugMsg ( QString ( " Simplification method type (%1) is not recognised" ).arg ( methodType ) );
134
+ }
135
+ }
136
+ return false ;
137
+ }
138
+
125
139
// /////
126
140
127
141
QgsFeatureIterator& QgsFeatureIterator::operator =( const QgsFeatureIterator & other )
0 commit comments