QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsrasterrange.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasterrange.h
3  --------------------------------------
4  Date : Oct 9, 2012
5  Copyright : (C) 2012 by Radim Blazek
6  email : radim dot blazek at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include <limits>
19 #include "qgis.h"
20 #include "qgsrasterrange.h"
21 
23  : mMin( std::numeric_limits<double>::quiet_NaN() )
24  , mMax( std::numeric_limits<double>::quiet_NaN() )
25 {
26 }
27 
28 QgsRasterRange::QgsRasterRange( double theMin, double theMax )
29  : mMin( theMin )
30  , mMax( theMax )
31 {
32 }
33 
35 {
36 }
37 
38 bool QgsRasterRange::contains( double value, const QgsRasterRangeList &rangeList )
39 {
40  foreach ( QgsRasterRange range, rangeList )
41  {
42  if (( value >= range.mMin && value <= range.mMax ) ||
43  qgsDoubleNear( value, range.mMin ) ||
44  qgsDoubleNear( value, range.mMax ) )
45  {
46  return true;
47  }
48  }
49  return false;
50 }
51