File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,12 @@ void QgsStatisticalSummary::reset()
47
47
mThirdQuartile = 0 ;
48
48
mValueCount .clear ();
49
49
mValues .clear ();
50
+
51
+ mRequiresHisto = mStatistics & QgsStatisticalSummary::Majority || mStatistics & QgsStatisticalSummary::Minority || mStatistics & QgsStatisticalSummary::Variety;
52
+
53
+ mRequiresAllValueStorage = mStatistics & QgsStatisticalSummary::StDev || mStatistics & QgsStatisticalSummary::StDevSample ||
54
+ mStatistics & QgsStatisticalSummary::Median || mStatistics & QgsStatisticalSummary::FirstQuartile ||
55
+ mStatistics & QgsStatisticalSummary::ThirdQuartile || mStatistics & QgsStatisticalSummary::InterQuartileRange;
50
56
}
51
57
52
58
/* **************************************************************************
@@ -74,12 +80,10 @@ void QgsStatisticalSummary::addValue( double value )
74
80
mMin = std::min ( mMin , value );
75
81
mMax = std::max ( mMax , value );
76
82
77
- if ( mStatistics & QgsStatisticalSummary::Majority || mStatistics & QgsStatisticalSummary::Minority || mStatistics & QgsStatisticalSummary::Variety )
83
+ if ( mRequiresHisto )
78
84
mValueCount .insert ( value, mValueCount .value ( value, 0 ) + 1 );
79
85
80
- if ( mStatistics & QgsStatisticalSummary::StDev || mStatistics & QgsStatisticalSummary::StDevSample ||
81
- mStatistics & QgsStatisticalSummary::Median || mStatistics & QgsStatisticalSummary::FirstQuartile ||
82
- mStatistics & QgsStatisticalSummary::ThirdQuartile || mStatistics & QgsStatisticalSummary::InterQuartileRange )
86
+ if ( mRequiresAllValueStorage )
83
87
mValues << value;
84
88
}
85
89
Original file line number Diff line number Diff line change @@ -292,6 +292,8 @@ class CORE_EXPORT QgsStatisticalSummary
292
292
double mThirdQuartile ;
293
293
QMap< double , int > mValueCount ;
294
294
QList< double > mValues ;
295
+ bool mRequiresAllValueStorage = false ;
296
+ bool mRequiresHisto = false ;
295
297
};
296
298
297
299
Q_DECLARE_OPERATORS_FOR_FLAGS ( QgsStatisticalSummary::Statistics )
You can’t perform that action at this time.
0 commit comments