Skip to content

Commit

Permalink
Documentation for QgsRasterRange
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 13, 2018
1 parent ef81f3c commit 0ab6327
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 21 deletions.
29 changes: 24 additions & 5 deletions python/core/auto_generated/raster/qgsrasterrange.sip.in
Expand Up @@ -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;

Expand Down
8 changes: 0 additions & 8 deletions src/core/raster/qgsrasterrange.cpp
Expand Up @@ -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 )
Expand Down
33 changes: 25 additions & 8 deletions src/core/raster/qgsrasterrange.h
Expand Up @@ -20,6 +20,7 @@

#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgis.h"
#include <QList>

class QgsRasterRange;
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 0ab6327

Please sign in to comment.