[libgfc Index] [libgfc Hierarchy] [Headers]
GGrid This is the class for grids which are regular 2D arrays of cells More...
#include <src/gadt_grid.h>
Inherits: GSpatial
GGrid This is the class for grids which are regular 2D arrays of cells. GFC grids are automatically decomposed into slabs (GSlab) when stored to permanent media, although this fact is largely hidden from general GGrid user. GGrid cells always contain values of the C float type.
GGrid is composed of a meta information struct (GGridMeta), a custom grid header (an opaque block of data supplied by the user), and the actual body of the cell values. The physical access to the cells is performed through an GGridIO object, which maintains a global cache of grid slabs to optimize the I/O. GFC provides a subclass of GGridIO which performs file based grid I/O. Other types of grid I/O, such as those based on database access methods, can also be plugged in by implementing differnt subclasses of GGridIO. GGridIO associates the slabs (hence the cells) in the cache with the grids through grid tags. Grid tags are strings that uniquely identify a grid when the program runs. Tags are automatically set to the name of the grid file when file-based grid I/O is used. Tags may also be database keys when database access methods are used for grid I/O, in which case the user is responsible for setting up the tags. The default grid I/O class is GGridIOFile. This can however be changed by calling the global function installGridIOHandler().
The physical layout of a grid (when stored to a file etc) is: GGridMeta meta_info; int custom_header_size; char* custom_header; int num_slabs; GSlabDesc *slab_descriptors; GSlab *slabs; Everything before the actual slab data ('slabs') is collectively refered as GGridHeader.
Many existing image and GIS raster data can also be imported as GGrid objects. The importing interface is defined by the generic GGridImporter class. In order to support a particular data format, such as USGS DEM, one only needs to implement a subclass of GGridImporter, (say GGridImporter_DEM), and install an instance of such a custom importer in the GGrid object prior to calling the generic GGrid::importFromFile() method.
[public]
print (only) the grid header
[public virtual]
generate a grid 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
[public virtual]
output the grid object into a user string. the format is the same as for input.
[public virtual]
pack the (zipped) grid data into a pipe
[public virtual]
unpack the (zipped) data from a pipe
[public virtual]
create a blank grid with the given size.
[public virtual]
store the (zipped) grid data into a file
[public virtual]
load grid data from a previously stored grid file
[public]
install a differnt importer object. The new importer will be used when importing data through the import methods.
[public]
imports a data file. the currently installed importer is used to open/read/import/close the data file. delegated to io_guy for the actual work.
[public]
imports a (in-memory) data stream. The currently installed importer is used to read/import the data stream. A temporary file will be created to hold the grid. delegated to io_guy for the actual work.
[public]
return the value type of cells.
[public virtual]
set a cell value. returns the old cell value.
[public virtual]
get the value of a cell.
[public virtual]
return a scan line of the grid. The line_buf must be preallocated with enough space (n_columns*Cell_Size)
[public]
set number of columns and rows of the grid.
[public]
return number of columns
[public]
return number of rows
[public]
return the maximum value
[public]
return maximum value for given region
[public]
return minimum value
[public]
return min value for given region
[public]
return average val. Note that cells with ignore_val are not counted when averaing.
[public]
return average value for given region
[public]
return the value to be ignored (for background/non-value)
[public]
set ignorant value
[public]
set easting value
[public]
return the easting value
[public]
set northing value
[public]
return the northing value
[public]
set geographic coordinates for lower corner
[public]
set the size of a cell
[public]
get the size of a cell
[public virtual]
calculate the statistics (min, max, average) of the grid. These statistics are updated and stored permanantly in the grid header.
Documentation generated by lqian@lqian-sun on Wed Jul 14 09:36:10 EDT 1999 | Kdoc |