iLand
Classes | Typedefs | Enumerations | Functions
grid.h File Reference
#include <QtCore>
#include <stdexcept>
#include <limits>
#include <cstring>
#include "global.h"

Go to the source code of this file.

Classes

class  Grid< T >
 Grid class (template). More...
 
class  GridRunner< T >
 helper class to iterate over a rectangular fraction of a grid More...
 
class  Vector3D
 simple 3d vector. More...
 

Typedefs

typedef Grid< float > FloatGrid
 

Enumerations

enum  GridViewType {
  GridViewRainbow =0 , GridViewRainbowReverse =1 , GridViewGray =2 , GridViewGrayReverse =3 ,
  GridViewHeat =4 , GridViewGreens =5 , GridViewReds =6 , GridViewBlues =7 ,
  GridViewTurbo =8 , GridViewBrewerDiv =10 , GridViewBrewerQual =11 , GridViewTerrain =12 ,
  GridViewCustom =14
}
 

Functions

QString gridToString (const FloatGrid &grid, const QChar sep=QChar(';'), const int newline_after=-1)
 dumps a FloatGrid to a String. More...
 
QImage gridToImage (const FloatGrid &grid, bool black_white=false, double min_value=0., double max_value=1., bool reverse=false)
 creates and return a QImage from Grid-Data. More...
 
bool loadGridFromImage (const QString &fileName, FloatGrid &rGrid)
 load into 'rGrid' the content of the image pointed at by 'fileName'. More...
 
template<class T >
QString gridToString (const Grid< T > &grid, const QChar sep=QChar(';'), const int newline_after=-1)
 template version for non-float grids (see also version for FloatGrid) More...
 
template<class T >
QString gridToString (const Grid< T > &grid, QString(*valueFunction)(const T &value), const QChar sep=QChar(';'), const int newline_after=-1)
 template version for non-float grids (see also version for FloatGrid) More...
 
void modelToWorld (const Vector3D &From, Vector3D &To)
 
template<class T >
QString gridToESRIRaster (const Grid< T > &grid, QString(*valueFunction)(const T &value))
 
template<class T >
QString gridToESRIRaster (const Grid< T > &grid)
 

Typedef Documentation

◆ FloatGrid

typedef Grid<float> FloatGrid

Enumeration Type Documentation

◆ GridViewType

Enumerator
GridViewRainbow 
GridViewRainbowReverse 
GridViewGray 
GridViewGrayReverse 
GridViewHeat 
GridViewGreens 
GridViewReds 
GridViewBlues 
GridViewTurbo 
GridViewBrewerDiv 
GridViewBrewerQual 
GridViewTerrain 
GridViewCustom 

Function Documentation

◆ gridToESRIRaster() [1/2]

template<class T >
QString gridToESRIRaster ( const Grid< T > &  grid)

◆ gridToESRIRaster() [2/2]

template<class T >
QString gridToESRIRaster ( const Grid< T > &  grid,
QString(*)(const T &value)  valueFunction 
)

◆ gridToImage()

QImage gridToImage ( const FloatGrid grid,
bool  black_white = false,
double  min_value = 0.,
double  max_value = 1.,
bool  reverse = false 
)

creates and return a QImage from Grid-Data.

Parameters
black_whitetrue: max_value = white, min_value = black, false: color-mode: uses a HSV-color model from blue (min_value) to red (max_value), default: color mode (false)
min_value,max_valuemin/max bounds for color calcuations. values outside bounds are limited to these values. defaults: min=0, max=1
reverseif true, color ramps are inversed (to: min_value = white (black and white mode) or red (color mode). default = false.
Returns
a QImage with the Grids size of pixels. Pixel coordinates relate to the index values of the grid.

◆ gridToString() [1/3]

QString gridToString ( const FloatGrid grid,
const QChar  sep = QChar(';'),
const int  newline_after = -1 
)

dumps a FloatGrid to a String.

rows will be y-lines, columns x-values. (see grid.cpp)

◆ gridToString() [2/3]

template<class T >
QString gridToString ( const Grid< T > &  grid,
const QChar  sep = QChar(';'),
const int  newline_after = -1 
)

template version for non-float grids (see also version for FloatGrid)

Parameters
sepstring separator
newline_afterif <>-1 a newline is added after every 'newline_after' data values

◆ gridToString() [3/3]

template<class T >
QString gridToString ( const Grid< T > &  grid,
QString(*)(const T &value)  valueFunction,
const QChar  sep = QChar(';'),
const int  newline_after = -1 
)

template version for non-float grids (see also version for FloatGrid)

Parameters
valueFunctionpointer to a function with the signature: QString func(const T&) : this should return a QString
sepstring separator
newline_afterif <>-1 a newline is added after every 'newline_after' data values

◆ loadGridFromImage()

bool loadGridFromImage ( const QString &  fileName,
FloatGrid rGrid 
)

load into 'rGrid' the content of the image pointed at by 'fileName'.

Pixels are converted to grey-scale and then transformend to a value ranging from 0..1 (black..white).

◆ modelToWorld()

void modelToWorld ( const Vector3D From,
Vector3D To 
)