GRaster Class Reference

[libgfc Index] [libgfc Hierarchy] [Headers]


ADT for raster data More...

#include <src/gadt_raster.h>

Inherits: GSpatial

Public Members

Protected Members


Detailed Description

ADT for raster data.

A raster is a regular grid of cells which are divided into "morton slabs" of fixed

size. Each slab is then stored individualy as one record. Besides

slabs, a raster object also contains a header which holds the meta

information of the raster object (such as size, number of slabs, file

id where the slabs are stored, and flags for compression etc). The header

of a raster also contains the indexing information to the records of

individual Slabs, so that individual slab can be retrieved quickly without

scanning the whole raster data.

8, 16, 24 and 32-bit rasters are all supported.

The raster can be compressed upon request, in which case every slab

will have their data compressed using the deflate algorithm of zlib.

This compress/uncompress procedure is transparent to GRaster users.


GRaster(int _bpp =16) [public]

initalize with specific bit depth. 16 bits for each value

GRaster(DataPipe& hdr_p) [public]

initialize the raster with a pipe containing header info

GRaster(const char* file) [public]

initialize the raster; open and load the file containing previously stored raster data

GRaster(const GRaster& r) [public]

copy ctor

GRaster& operator=(const GRaster& r) [public]

assignment operator

friend ostream& operator<<(ostream& s, const GRaster& ras) [public]

print (only) the raster header

Result input(const char* in) [public virtual]

generate a raster object out of a user string; the format of the string: "w h V00 V01 V02... V10 V11 V12... Vwh" where w and h are the width and height of the user supplied grid

Result output(char*& out) [public virtual]

output the raster object into a user string. the format is the same as for input.

Result pack(DataPipe& p) [public virtual]

pack the (zipped) raster data into a pipe

Result unpack(DataPipe& p) [public virtual]

unpack the (zipped) data from a pipe

Result storeToFile(const char* fname) [public virtual]

store the (zipped) raster data into a file

Result loadFromFile(const char* fname) [public virtual]

load raster data from a previously stored raster file

Result import(const char* fname, int w, int h, FileType t=ascii, int val_sz=16, bool zipit=0) [public virtual]

import user specified raster data file; it may be a text file or binary. The user specify the size (in byte) for the values. The width and height of the raster should also be specified. The user file should contain nothing but the data itself. The fifth parameter indicates whether the result raster object should be zipped or not. Note that a raster image can only have ineger values.

inline int width() [public]

return number of cells on x dimension

inline int height() [public]

return number of cells on y dimension

inline double max() [public]

retu4n maximum value

double max(GRect& r) [public]

return maximum value for given region

inline double min() [public]

return minimum value

double min(GRect& r) [public]

return min value for given region

inline double avg() [public]

return average val

double avg(GRect& r) [public]

return average value for given region

inline int ignore() const [public]

return the value to be ignored (for background/non-value)

inline void setIgnoreValue(int v) [public]

set ignorant value

inline int easting() const [public]

return the easting value

inline int northing() const [public]

return the northing value

inline void setEasting(int e) [public]

set easting value

inline void setNorthing(int n) [public]

set northing value

inline void setFactor(double f) [public]

set the factor

inline double factor() [public]

get the factor

inline void setGeoLow(int glx, int gly) [public]

set geographic coordinates for lower corner

inline void setCellSize(int sz) [public]

set the size of a pixel (cell)

inline int cellSize() [public]

get the size of a pixel

inline int numSlabs() [public]

return number of slabs.

Result setPixel(int val, int x, int y) [public virtual]

set a pixel value

int getPixel(int x, int y) [public virtual]

get the value of a pixel. Note that the value returned is not adjusted. To get the true value at the pixel you must divide it by factor() !

GSlab* getSlab(int idx) [public]

return a pointer to the slab with given id

Result scanLine(int y, char* line_buf) [public virtual]

return a scan line of the raster

Result toRowOrder(float * va) [public virtual]

convert the raster to linear array of float-value with row-major order

void setZipped(void) [public]

set the raster to be zipped (compressed)

bool zipped(void) [public]

return true if the raster is zipped on storage

Result updateStats() [public virtual]

calculate the statistics (min, max, average) of the raster. These statistics are updated and stored permanantly in the raster header.

Result loadSlab(int idx) [protected virtual]

retrieve the slab with given index; in GFC it is retrieved from a previously written raster data file; in a DB contecxt the programmer can inherit this class and override this method so that individual slab will be fetched from the db (out of a table for instance.)

int storeSlab(GSlab& s) [protected virtual]

store an individual slab into the data file; (or to a db table if the programmer choose to do so in an overriden function. return the (zipped) size actulay stored into the file. or -1 if failed.


Documentation generated by lqian@lqian-sun on Wed Jul 14 09:36:10 EDT 1999
Kdoc