GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
tilewrite.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <grass/raster.h>
#include "raster3d_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 Rast3d_write_tile (RASTER3D_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 Rast3d_write_tile_float (RASTER3D_Map *map, int tileIndex, const void *tile)
 Is equivalent to Rast3d_write_tile (map, tileIndex, tile, FCELL_TYPE). More...
 
int Rast3d_write_tile_double (RASTER3D_Map *map, int tileIndex, const void *tile)
 Is equivalent to Rast3d_write_tile (map, tileIndex, tile, DCELL_TYPE). More...
 
int Rast3d_flush_tile (RASTER3D_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 Rast3d_flush_tile, a tile filled with NULL-values is written. More...
 
int Rast3d_flush_tile_cube (RASTER3D_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 Rast3d_flush_tiles_in_cube (RASTER3D_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...
 

Macro Definition Documentation

◆ MAX

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

Definition at line 281 of file tilewrite.c.

Referenced by Rast3d_flush_tiles_in_cube().

◆ MIN

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

Definition at line 280 of file tilewrite.c.

Referenced by Rast3d_flush_tiles_in_cube().

Function Documentation

◆ Rast3d_flush_tile()

int Rast3d_flush_tile ( RASTER3D_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 Rast3d_flush_tile, 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 NULL, Rast3d__remove_tile(), Rast3d_error(), Rast3d_get_tile_ptr(), Rast3d_write_tile(), and RASTER3D_Map::typeIntern.

Referenced by Rast3d_flush_tile_cube().

◆ Rast3d_flush_tile_cube()

int Rast3d_flush_tile_cube ( RASTER3D_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 Rast3d_error(), Rast3d_fatal_error(), Rast3d_flush_tile(), Rast3d_tile2tile_index(), RASTER3D_Map::useCache, and x.

Referenced by Rast3d_flush_tiles_in_cube().

◆ Rast3d_flush_tiles_in_cube()

int Rast3d_flush_tiles_in_cube ( RASTER3D_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 MAX, MIN, Rast3d_coord2tile_coord(), Rast3d_error(), Rast3d_fatal_error(), Rast3d_flush_tile_cube(), Rast3d_get_coords_map(), and RASTER3D_Map::useCache.

◆ Rast3d_write_tile()

int Rast3d_write_tile ( RASTER3D_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 127 of file tilewrite.c.

References RASTER3D_Map::data_fd, RASTER3D_Map::index, RASTER3D_Map::nTiles, Rast3d_compute_clipped_tile_dimensions(), Rast3d_error(), Rast3d_fatal_error(), and Rast3d_range_update_from_tile().

Referenced by Rast3d_flush_tile(), Rast3d_write_tile_double(), and Rast3d_write_tile_float().

◆ Rast3d_write_tile_double()

int Rast3d_write_tile_double ( RASTER3D_Map map,
int  tileIndex,
const void *  tile 
)

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

Parameters
map
tileIndex
tile
Returns
int

Definition at line 219 of file tilewrite.c.

References DCELL_TYPE, Rast3d_error(), and Rast3d_write_tile().

◆ Rast3d_write_tile_float()

int Rast3d_write_tile_float ( RASTER3D_Map map,
int  tileIndex,
const void *  tile 
)

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

Parameters
map
tileIndex
tile
Returns
int

Definition at line 194 of file tilewrite.c.

References FCELL_TYPE, Rast3d_error(), and Rast3d_write_tile().