QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgsrenderedlayerstatistics.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsrenderedlayerstatistics.cpp
3 ----------------
4 copyright : (C) 2024 by Jean Felder
5 email : jean dot felder at oslandia dot com
6 ***************************************************************************/
7
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
18
19QgsRenderedLayerStatistics::QgsRenderedLayerStatistics( const QString &layerId, const QList<double> &minimum, const QList<double> &maximum )
20 : QgsRenderedItemDetails( layerId )
21 , mMin( minimum )
22 , mMax( maximum )
23{
24
25}
26
27QgsRenderedLayerStatistics::QgsRenderedLayerStatistics( const QString &layerId, double minimum, double maximum )
28 : QgsRenderedItemDetails( layerId )
29 , mMin( {minimum} )
30, mMax( {maximum} )
31{
32
33}
34
36{
37 return mMin;
38}
39
40double QgsRenderedLayerStatistics::minimum( int index ) const
41{
42 if ( index < 0 || index >= mMin.size() )
43 {
44 return std::numeric_limits<double>::quiet_NaN();
45 }
46
47 return mMin.at( index );
48}
49
51{
52 return mMax;
53}
54
55double QgsRenderedLayerStatistics::maximum( int index ) const
56{
57 if ( index < 0 || index >= mMax.size() )
58 {
59 return std::numeric_limits<double>::quiet_NaN();
60 }
61
62 return mMax.at( index );
63}
64
65
66void QgsRenderedLayerStatistics::setMinimum( QList<double> &minimum )
67{
68 mMin = minimum;
69}
70
71bool QgsRenderedLayerStatistics::setMinimum( int index, double minimum )
72{
73 if ( index < 0 || index >= mMax.size() )
74 {
75 return false;
76 }
77
78 mMin[index] = minimum;
79 return true;
80}
81
82void QgsRenderedLayerStatistics::setMaximum( QList<double> &maximum )
83{
84 mMax = maximum;
85}
86
87bool QgsRenderedLayerStatistics::setMaximum( int index, double maximum )
88{
89 if ( index < 0 || index >= mMax.size() )
90 {
91 return false;
92 }
93
94 mMax[index] = maximum;
95 return true;
96}
Base class for detailed information about a rendered item.
QgsRenderedLayerStatistics(const QString &layerId, const QList< double > &minimum, const QList< double > &maximum)
Constructor for QgsRenderedLayerStatistics from a list of minimum and maximum.
QList< double > maximum() const
Returns the maximum values of the computed statistics.
void setMaximum(QList< double > &maximum)
Sets the maximum values of the computed statistics.
void setMinimum(QList< double > &minimum)
Sets the minimum values of the computed statistics.
QList< double > minimum() const
Returns the minimum values of the computed statistics.