proland::InputMap Class Reference
[preprocess]

An abstract raster data map. More...

#include <Preprocess.h>

List of all members.

Public Member Functions

 InputMap (int width, int height, int channels, int tileSize, int cache=20)
 Creates a new map.
 ~InputMap ()
 Deletes this input map.
virtual vec4f getValue (int x, int y)=0
 Returns the value of the given pixel.
virtual float * getValues (int tx, int ty)
 Returns the values of the pixels of the given tile.
vec4f get (int x, int y)
 Returns the value of the given pixel.

Public Attributes

int width
 The width of this map.
int height
 The height of this map.
int channels
 The number of components per pixel of this map.
int tileSize
 The tile size to use when reading this map by tile.

Detailed Description

An abstract raster data map.

A map is a 2D array of pixels, whose values can come from anywhere (this depends on how you implement the getValue method). A map can be read pixel by pixel, or tile by tile. The tiles are cached for better efficiency.

Author:
Eric Bruneton

Constructor & Destructor Documentation

proland::InputMap::InputMap ( int  width,
int  height,
int  channels,
int  tileSize,
int  cache = 20 
)

Creates a new map.

Parameters:
width the width of this map.
height the height of this map.
channels the number of components per pixel of this map.
tileSize the tile size to use when reading this map by tile. The width and height must be multiples of this size.
cache how much tiles can be cached at the same time.
proland::InputMap::~InputMap (  ) 

Deletes this input map.


Member Function Documentation

vec4f proland::InputMap::get ( int  x,
int  y 
)

Returns the value of the given pixel.

This method uses a cache for better efficiency: it reads the tile containing the given pixel, if it is not already in cache, puts it in cache, and returns the requested pixel from this tile.

Parameters:
x the x coordinate of the pixel to be read.
y the y coordinate of the pixel to be read.
Returns:
the value of the (x,y) pixel.
virtual vec4f proland::InputMap::getValue ( int  x,
int  y 
) [pure virtual]

Returns the value of the given pixel.

You can implement this method any way you want.

Parameters:
x the x coordinate of the pixel to be read.
y the y coordinate of the pixel to be read.
Returns:
the value of the (x,y) pixel.
virtual float* proland::InputMap::getValues ( int  tx,
int  ty 
) [virtual]

Returns the values of the pixels of the given tile.

The default implementation of this method calls getValue to read each pixel. If getValue reads a value from disk, it is strongly advised to override this method for better efficiency.

Parameters:
tx the tx coordinate of the pixel to be read.
ty the ty coordinate of the pixel to be read.
Returns:
an array of size tileSize x tileSize, containing the values of the pixels in the [ tx * tileSize , (tx+1) * tileSize [ x [ ty * tileSize , (ty+1) * tileSize [ region.

Member Data Documentation

The number of components per pixel of this map.

The height of this map.

The tile size to use when reading this map by tile.

The width and height must be multiples of this size.

The width of this map.


Generated on Sat May 12 09:42:13 2012 for proland by  doxygen 1.6.1