QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsrenderedlayerstatistics.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsrenderedlayerstatistics.h
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#ifndef QGSRENDEREDLAYERSTATISTICS_H
18#define QGSRENDEREDLAYERSTATISTICS_H
19
20#include <limits>
21
22#include "qgis_core.h"
23#include "qgis_sip.h"
25
32{
33 public:
34
42 QgsRenderedLayerStatistics( const QString &layerId, const QList<double> &minimum, const QList<double> &maximum );
43
47#ifndef SIP_RUN
48 QgsRenderedLayerStatistics( const QString &layerId, double minimum = std::numeric_limits<double>::quiet_NaN(), double maximum = std::numeric_limits<double>::quiet_NaN() );
49#else
50 QgsRenderedLayerStatistics( const QString &layerId, SIP_PYOBJECT minimum SIP_TYPEHINT( Optional[float] ) = Py_None, SIP_PYOBJECT maximum SIP_TYPEHINT( Optional[float] ) = Py_None ) [( const QString & layerId, double minimum = 0.0, double maximum = 0.0 )];
51 % MethodCode
52 double minP = a1 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a1 );
53 double maxP = a2 == Py_None ? std::numeric_limits<double>::quiet_NaN() : PyFloat_AsDouble( a2 );
54 QList<double> minL = {minP};
55 QList<double> maxL = {maxP};
56 sipCpp = new sipQgsRenderedLayerStatistics( *a0, minL, maxL );
57 % End
58#endif
59
60#ifdef SIP_RUN
61 SIP_PYOBJECT __repr__();
62 % MethodCode
63 QStringList minimums;
64 minimums.reserve( sipCpp->minimum().size() );
65 for ( double min : sipCpp->minimum() )
66 {
67 minimums.append( QString::number( min ) );
68 }
69 QStringList maximums;
70 maximums.reserve( sipCpp->maximum().size() );
71 for ( double max : sipCpp->maximum() )
72 {
73 maximums.append( QString::number( max ) );
74 }
75 QString str = QStringLiteral( "<QgsRenderedLayerStatistics: %1 (min: %2 - max: %3)>" ).arg( sipCpp->layerId(), minimums.join( ',' ), maximums.join( ',' ) );
76 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
77 % End
78#endif
79
84 QList<double> minimum() const;
85
90 double minimum( int index ) const;
91
96 QList<double> maximum() const;
97
102 double maximum( int index ) const;
103
108 void setMinimum( QList<double> &minimum );
109
115 bool setMinimum( int index, double minimum );
116
121 void setMaximum( QList<double> &maximum );
122
128 bool setMaximum( int index, double maximum );
129
130 private:
131
132 QList<double> mMin;
133 QList<double> mMax;
134};
135
136#endif // QGSRENDEREDLAYERSTATISTICS_H
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.
#define SIP_TYPEHINT(type)
Definition qgis_sip.h:240