QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
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
17
#include "
qgsrenderedlayerstatistics.h
"
18
19
QgsRenderedLayerStatistics::QgsRenderedLayerStatistics
(
const
QString &
layerId
,
const
QList<double> &
minimum
,
const
QList<double> &
maximum
)
20
:
QgsRenderedItemDetails
(
layerId
)
21
, mMin(
minimum
)
22
, mMax(
maximum
)
23
{}
24
25
QgsRenderedLayerStatistics::QgsRenderedLayerStatistics
(
const
QString &
layerId
,
double
minimum
,
double
maximum
)
26
:
QgsRenderedItemDetails
(
layerId
)
27
, mMin( {
minimum
} )
28
, mMax( { maximum } )
29
{}
30
31
QList<double>
QgsRenderedLayerStatistics::minimum
()
const
32
{
33
return
mMin;
34
}
35
36
double
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
46
QList<double>
QgsRenderedLayerStatistics::maximum
()
const
47
{
48
return
mMax;
49
}
50
51
double
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
62
void
QgsRenderedLayerStatistics::setMinimum
( QList<double> &
minimum
)
63
{
64
mMin =
minimum
;
65
}
66
67
bool
QgsRenderedLayerStatistics::setMinimum
(
int
index,
double
minimum
)
68
{
69
if
( index < 0 || index >= mMax.size() )
70
{
71
return
false
;
72
}
73
74
mMin[index] =
minimum
;
75
return
true
;
76
}
77
78
void
QgsRenderedLayerStatistics::setMaximum
( QList<double> &
maximum
)
79
{
80
mMax =
maximum
;
81
}
82
83
bool
QgsRenderedLayerStatistics::setMaximum
(
int
index,
double
maximum
)
84
{
85
if
( index < 0 || index >= mMax.size() )
86
{
87
return
false
;
88
}
89
90
mMax[index] =
maximum
;
91
return
true
;
92
}
QgsRenderedItemDetails::QgsRenderedItemDetails
QgsRenderedItemDetails(const QString &layerId)
Constructor for QgsRenderedItemDetails.
Definition
qgsrendereditemdetails.cpp:19
QgsRenderedItemDetails::layerId
QString layerId() const
Returns the layer ID of the associated map layer.
Definition
qgsrendereditemdetails.h:60
QgsRenderedLayerStatistics::QgsRenderedLayerStatistics
QgsRenderedLayerStatistics(const QString &layerId, const QList< double > &minimum, const QList< double > &maximum)
Constructor for QgsRenderedLayerStatistics from a list of minimum and maximum.
Definition
qgsrenderedlayerstatistics.cpp:19
QgsRenderedLayerStatistics::maximum
QList< double > maximum() const
Returns the maximum values of the computed statistics.
Definition
qgsrenderedlayerstatistics.cpp:46
QgsRenderedLayerStatistics::setMaximum
void setMaximum(QList< double > &maximum)
Sets the maximum values of the computed statistics.
Definition
qgsrenderedlayerstatistics.cpp:78
QgsRenderedLayerStatistics::setMinimum
void setMinimum(QList< double > &minimum)
Sets the minimum values of the computed statistics.
Definition
qgsrenderedlayerstatistics.cpp:62
QgsRenderedLayerStatistics::minimum
QList< double > minimum() const
Returns the minimum values of the computed statistics.
Definition
qgsrenderedlayerstatistics.cpp:31
qgsrenderedlayerstatistics.h
Generated on
for QGIS API Documentation by
1.17.0