QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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 )
21 , mMin( minimum )
22 , mMax( maximum )
23{}
24
27 , mMin( { minimum } )
28 , mMax( { maximum } )
29{}
30
32{
33 return mMin;
34}
35
36double QgsRenderedLayerStatistics::minimum( int index ) const
37{
38 if ( index < 0 || index >= mMin.size() )
39 {
40 return std::numeric_limits<double>::quiet_NaN();
41 }
42
43 return mMin.at( index );
44}
45
47{
48 return mMax;
49}
50
51double QgsRenderedLayerStatistics::maximum( int index ) const
52{
53 if ( index < 0 || index >= mMax.size() )
54 {
55 return std::numeric_limits<double>::quiet_NaN();
56 }
57
58 return mMax.at( index );
59}
60
61
63{
64 mMin = minimum;
65}
66
68{
69 if ( index < 0 || index >= mMax.size() )
70 {
71 return false;
72 }
73
74 mMin[index] = minimum;
75 return true;
76}
77
79{
80 mMax = maximum;
81}
82
84{
85 if ( index < 0 || index >= mMax.size() )
86 {
87 return false;
88 }
89
90 mMax[index] = maximum;
91 return true;
92}
QgsRenderedItemDetails(const QString &layerId)
Constructor for QgsRenderedItemDetails.
QString layerId() const
Returns the layer ID of the associated map layer.
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.