GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
tilewrite.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
#include "G3d_intern.h"
Include dependency graph for tilewrite.c:

Go to the source code of this file.

Macros

#define MIN(a, b)   (a < b ? a : b)
 
#define MAX(a, b)   (a > b ? a : b)
 

Functions

int G3d_writeTile (G3D_Map *map, int tileIndex, const void *tile, int type)
 Writes tile with index tileIndex to the file corresponding to map. It is assumed that the cells in tile are of type which must be one of FCELL_TYPE and DCELL_TYPE. The actual type used to write the tile depends on the type specified at the time when map is initialized. A tile can only be written once. Subsequent attempts to write the same tile are ignored. More...
 
int G3d_writeTileFloat (G3D_Map *map, int tileIndex, const void *tile)
 Is equivalent to G3d_writeTile (map, tileIndex, tile, FCELL_TYPE). More...
 
int G3d_writeTileDouble (G3D_Map *map, int tileIndex, const void *tile)
 Is equivalent to G3d_writeTile (map, tileIndex, tile, DCELL_TYPE). More...
 
int G3d_flushTile (G3D_Map *map, int tileIndex)
 Writes the tile with tileIndex to the file corresponding to map and removes the tile from the cache (in non-cache mode the buffer provided by the map-structure is written). If this tile has already been written before the write request is ignored. If the tile was never referred to before the invokation of G3d_flushTile, a tile filled with NULL-values is written. More...
 
int G3d_flushTileCube (G3D_Map *map, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax)
 Writes the tiles with tile-coordinates contained in the axis-parallel cube with vertices (xMin, yMin, zMin) and (xMax, yMax, zMax). Tiles which are not stored in the cache are written as NULL-tiles. Write attempts for tiles which have already been written earlier are ignored. More...
 
int G3d_flushTilesInCube (G3D_Map *map, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax)
 Writes those tiles for which every cell has coordinate contained in the axis-parallel cube defined by the vertices with cell-coordinates (xMin, yMin, zMin) and (xMax, yMax, zMax). Tiles which are not stored in the cache are written as NULL-tiles. Write attempts for tiles which have already been written earlier are ignored. More...
 
int G3d_putDouble ()
 Is equivalent to G3d_putValue (map, x, y, z, &value, DCELL_TYPE). More...
 
int G3d_putFloat (G3D_Map *map, int x, int y, int z, float value)
 Is equivalent to G3d_putValue (map, x, y, z, &value, FCELL_TYPE). More...
 
int G3d_putDouble (G3D_Map *map, int x, int y, int z, double value)
 Is equivalent to G3d_putValue (map, x, y, z, &value, DCELL_TYPE). More...
 
int G3d_putValue (G3D_Map *map, int x, int y, int z, const void *value, int type)
 After converting *value of type into the type specified at the initialization time (i.e. typeIntern) this function writes the value into the tile buffer corresponding to cell-coordinate (x, y, z). More...
 

Macro Definition Documentation

#define MAX (   a,
  b 
)    (a > b ? a : b)

Definition at line 281 of file tilewrite.c.

Referenced by G3d_flushTilesInCube().

#define MIN (   a,
  b 
)    (a < b ? a : b)

Definition at line 280 of file tilewrite.c.

Referenced by G3d_flushTilesInCube().

Function Documentation

int G3d_flushTile ( G3D_Map *  map,
int  tileIndex 
)

Writes the tile with tileIndex to the file corresponding to map and removes the tile from the cache (in non-cache mode the buffer provided by the map-structure is written). If this tile has already been written before the write request is ignored. If the tile was never referred to before the invokation of G3d_flushTile, a tile filled with NULL-values is written.

Parameters
map
tileIndex
Returns
1 ... if successful, 0 ... otherwise.

Definition at line 254 of file tilewrite.c.

References G3d__removeTile(), G3d_error(), G3d_getTilePtr(), G3d_writeTile(), NULL, and utils::tile.

Referenced by G3d_flushTileCube().

int G3d_flushTileCube ( G3D_Map *  map,
int  xMin,
int  yMin,
int  zMin,
int  xMax,
int  yMax,
int  zMax 
)

Writes the tiles with tile-coordinates contained in the axis-parallel cube with vertices (xMin, yMin, zMin) and (xMax, yMax, zMax). Tiles which are not stored in the cache are written as NULL-tiles. Write attempts for tiles which have already been written earlier are ignored.

Parameters
map
xMin
yMin
zMin
xMax
yMax
zMax
Returns
1 ... if successful, 0 ... otherwise.

Definition at line 306 of file tilewrite.c.

References G3d_error(), G3d_fatalError(), G3d_flushTile(), G3d_tile2tileIndex(), and y.

Referenced by G3d_flushTilesInCube().

int G3d_flushTilesInCube ( G3D_Map *  map,
int  xMin,
int  yMin,
int  zMin,
int  xMax,
int  yMax,
int  zMax 
)

Writes those tiles for which every cell has coordinate contained in the axis-parallel cube defined by the vertices with cell-coordinates (xMin, yMin, zMin) and (xMax, yMax, zMax). Tiles which are not stored in the cache are written as NULL-tiles. Write attempts for tiles which have already been written earlier are ignored.

Parameters
map
xMin
yMin
zMin
xMax
yMax
zMax
Returns
1 ... if successful, 0 ... otherwise.

Definition at line 352 of file tilewrite.c.

References G3d_coord2tileCoord(), G3d_error(), G3d_fatalError(), G3d_flushTileCube(), G3d_getCoordsMap(), MAX, and MIN.

int G3d_putDouble ( )

Is equivalent to G3d_putValue (map, x, y, z, &value, DCELL_TYPE).

Parameters
map
x
y
z
value
Returns
int

Referenced by G3d_putFloat(), G3d_putValue(), and N_write_array_3d_to_rast3d().

int G3d_putDouble ( G3D_Map *  map,
int  x,
int  y,
int  z,
double  value 
)

Is equivalent to G3d_putValue (map, x, y, z, &value, DCELL_TYPE).

Parameters
map
x
y
z
value
Returns
int

Definition at line 496 of file tilewrite.c.

References G3d_coord2tileIndex(), G3d_error(), G3d_getTilePtr(), G3d_putFloat(), NULL, utils::tile, and value.

int G3d_putFloat ( G3D_Map *  map,
int  x,
int  y,
int  z,
float  value 
)

Is equivalent to G3d_putValue (map, x, y, z, &value, FCELL_TYPE).

Parameters
map
x
y
z
value
Returns
int

Definition at line 456 of file tilewrite.c.

References G3d_coord2tileIndex(), G3d_error(), G3d_getTilePtr(), G3d_putDouble(), NULL, utils::tile, and value.

Referenced by G3d_putDouble(), G3d_putValue(), and N_write_array_3d_to_rast3d().

int G3d_putValue ( G3D_Map *  map,
int  x,
int  y,
int  z,
const void *  value,
int  type 
)

After converting *value of type into the type specified at the initialization time (i.e. typeIntern) this function writes the value into the tile buffer corresponding to cell-coordinate (x, y, z).

Parameters
map
x
y
z
value
type
Returns
1 ... if successful, 0 ... otherwise.

Definition at line 540 of file tilewrite.c.

References G3d_error(), G3d_putDouble(), and G3d_putFloat().

Referenced by G3d_makeAlignedVolumeFile(), and G3d_retile().

int G3d_writeTile ( G3D_Map *  map,
int  tileIndex,
const void *  tile,
int  type 
)

Writes tile with index tileIndex to the file corresponding to map. It is assumed that the cells in tile are of type which must be one of FCELL_TYPE and DCELL_TYPE. The actual type used to write the tile depends on the type specified at the time when map is initialized. A tile can only be written once. Subsequent attempts to write the same tile are ignored.

Parameters
map
tileIndex
tile
type
Returns
1 ... if successful, 2 ... if write request was ignored, 0 ... otherwise.

Definition at line 128 of file tilewrite.c.

References dialogs::cols, G3d_computeClippedTileDimensions(), G3d_error(), G3d_fatalError(), and G3d_range_updateFromTile().

Referenced by G3d_changePrecision(), G3d_changeType(), G3d_flushTile(), G3d_writeTileDouble(), and G3d_writeTileFloat().

int G3d_writeTileDouble ( G3D_Map *  map,
int  tileIndex,
const void *  tile 
)

Is equivalent to G3d_writeTile (map, tileIndex, tile, DCELL_TYPE).

Parameters
map
tileIndex
tile
Returns
int

Definition at line 219 of file tilewrite.c.

References G3d_error(), and G3d_writeTile().

int G3d_writeTileFloat ( G3D_Map *  map,
int  tileIndex,
const void *  tile 
)

Is equivalent to G3d_writeTile (map, tileIndex, tile, FCELL_TYPE).

Parameters
map
tileIndex
tile
Returns
int

Definition at line 194 of file tilewrite.c.

References G3d_error(), and G3d_writeTile().