Documentation for QgsRasterRange

This commit is contained in:
Nyall Dawson 2018-06-07 10:03:54 +10:00
parent ef81f3c5c6
commit 0ab63274f6
3 changed files with 49 additions and 21 deletions

View File

@ -26,22 +26,41 @@ including min and max value.
QgsRasterRange();
%Docstring
Constructor.
Default constructor, both min and max value for the range will be set to NaN.
%End
QgsRasterRange( double min, double max );
%Docstring
Constructor
:param min: minimum value
:param max: max value
Constructor for a range with the given ``min`` and ``max`` values.
%End
double min() const;
%Docstring
Returns the minimum value for the range.
.. seealso:: :py:func:`setMin`
%End
double max() const;
%Docstring
Returns the maximum value for the range.
.. seealso:: :py:func:`setMax`
%End
double setMin( double min );
%Docstring
Sets the minimum value for the range.
.. seealso:: :py:func:`min`
%End
double setMax( double max );
%Docstring
Sets the maximum value for the range.
.. seealso:: :py:func:`max`
%End
bool operator==( QgsRasterRange o ) const;

View File

@ -15,16 +15,8 @@
* *
***************************************************************************/
#include <limits>
#include "qgis.h"
#include "qgsrasterrange.h"
QgsRasterRange::QgsRasterRange()
: mMin( std::numeric_limits<double>::quiet_NaN() )
, mMax( std::numeric_limits<double>::quiet_NaN() )
{
}
QgsRasterRange::QgsRasterRange( double min, double max )
: mMin( min )
, mMax( max )

View File

@ -20,6 +20,7 @@
#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgis.h"
#include <QList>
class QgsRasterRange;
@ -36,21 +37,37 @@ class CORE_EXPORT QgsRasterRange
public:
/**
* \brief Constructor.
* Default constructor, both min and max value for the range will be set to NaN.
*/
QgsRasterRange();
QgsRasterRange() = default;
/**
* \brief Constructor
* \param min minimum value
* \param max max value
* Constructor for a range with the given \a min and \a max values.
*/
QgsRasterRange( double min, double max );
/**
* Returns the minimum value for the range.
* \see setMin()
*/
double min() const { return mMin; }
/**
* Returns the maximum value for the range.
* \see setMax()
*/
double max() const { return mMax; }
/**
* Sets the minimum value for the range.
* \see min()
*/
double setMin( double min ) { return mMin = min; }
/**
* Sets the maximum value for the range.
* \see max()
*/
double setMax( double max ) { return mMax = max; }
inline bool operator==( QgsRasterRange o ) const
@ -59,7 +76,7 @@ class CORE_EXPORT QgsRasterRange
}
/**
* \brief Test if value is within the list of ranges
* \brief Tests if a \a value is within the list of ranges
* \param value value
* \param rangeList list of ranges
* \returns true if value is in at least one of ranges
@ -68,8 +85,8 @@ class CORE_EXPORT QgsRasterRange
static bool contains( double value, const QgsRasterRangeList &rangeList ) SIP_SKIP;
private:
double mMin;
double mMax;
double mMin = std::numeric_limits<double>::quiet_NaN();
double mMax = std::numeric_limits<double>::quiet_NaN();
};
#endif