NoDataType Class Reference

Class for storing a type independent a nodata value (nodata value can be deactivated as well) More...

#include "NoDataType.hpp"

+ Inheritance diagram for NoDataType:

Public Types

enum  Type {
  none = -1, value, min, max,
  nan, bitmask
}
 

Public Member Functions

 NoDataType (Type t)
 
 NoDataType (double v)
 
bool isEmpty () const
 check if nodata value is deactivated
 
void setType (Type t)
 set type independent nodata value or deactivate the nodata value
 
void setValue (double v)
 set a specific nodata value
 
Type getType () const
 returns the nodata value type
 
double getValue () const
 return a specific nodata value (only relevant if type is Type::value)
 
double getValue (RasterDataType rasterType) const
 returns the nodata value for the given raster type. If the value cannot be converted to the given raster type an exception is thrown. Reasons for exceptions: More...
 
double getValue (RasterDataType rasterType, bool &wasCropped) const
 returns the nodata value for the given raster type but doesn't throw an exception if the value exceeds raster type limits (see above)
 
void setFromDouble (double v, RasterDataType rasterType)
 set the nodata value for a given double value considering the raster type (useful when setting from GDAL nodata value).
 

Static Public Member Functions

CustomOptionType interface
static const char * help (bool)
 
static const char * syntax ()
 
static bool exportsPythonType ()
 
- Static Public Member Functions inherited from CustomOptionType< NoDataType >
static const char * _help (bool forDoxygen)
 get general help on this type
 
static const char * _syntax ()
 get the syntax used for parsing this type
 
static bool _exportsPythonType ()
 returns true if this type is exposed to Python as a custom type, false otherwise (if it is represented as Python-string)
 

Protected Attributes

Type type_
 
double value_
 

Additional Inherited Members

- Protected Member Functions inherited from CustomOptionType< NoDataType >
 ~CustomOptionType ()
 protected, must be derived from
 

Detailed Description

Class for storing a type independent a nodata value (nodata value can be deactivated as well)

Member Enumeration Documentation

◆ Type

enum Type
Enumerator
none 

deactivates the nodata value

value 

use the provided value

min 

use the lowest value of the raster type as nodata value

max 

use the highest value of the raster type as nodata value

nan 

use Not-A-Number for floating-point and 'max' for integer raster types as nodata value

bitmask 

use a separate bitmask as nodata information instead of a specific value

Member Function Documentation

◆ getValue()

double getValue ( RasterDataType  rasterType) const

returns the nodata value for the given raster type. If the value cannot be converted to the given raster type an exception is thrown. Reasons for exceptions:

  1. type is none (isEmpty() == true)
  2. raster type cannot represent type (getType() == nan and any integer raster type)
  3. value exceeds raster type limits