GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-b4e4cb0fe9
|
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include "raster3d_intern.h"
Go to the source code of this file.
Functions | |
void | Rast3d_tile_index2tile (RASTER3D_Map *map, int tileIndex, int *xTile, int *yTile, int *zTile) |
Converts index tileIndex into tile-coordinates (xTile, yTile, zTile). More... | |
int | Rast3d_tile2tile_index (RASTER3D_Map *map, int xTile, int yTile, int zTile) |
Returns tile-index corresponding to tile-coordinates (xTile, yTile, zTile). More... | |
void | Rast3d_tile_coord_origin (RASTER3D_Map *map, int xTile, int yTile, int zTile, int *x, int *y, int *z) |
Computes the cell-coordinates (x, y, z) which correspond to the origin of the tile with tile-coordinates (xTile, yTile, zTile). More... | |
void | Rast3d_tile_index_origin (RASTER3D_Map *map, int tileIndex, int *x, int *y, int *z) |
Computes the cell-coordinates (x, y, z) which correspond to the origin of the tile with tileIndex. More... | |
void | Rast3d_coord2tile_coord (RASTER3D_Map *map, int x, int y, int z, int *xTile, int *yTile, int *zTile, int *xOffs, int *yOffs, int *zOffs) |
Converts cell-coordinates (x, y, z) into tile-coordinates (xTile, yTile, zTile) and the coordinate of the cell (xOffs, yOffs, zOffs) within the tile. More... | |
void | Rast3d_coord2tile_index (RASTER3D_Map *map, int x, int y, int z, int *tileIndex, int *offset) |
Converts cell-coordinates (x, y, z) into tileIndex and the offset of the cell within the tile. More... | |
int | Rast3d_coord_in_range (RASTER3D_Map *map, int x, int y, int z) |
Returns 1 if cell-coordinate (x, y, z) is a coordinate inside the region. Returns 0 otherwise. More... | |
int | Rast3d_tile_index_in_range (RASTER3D_Map *map, int tileIndex) |
Returns 1 if tileIndex is a valid index for map. Returns 0 otherwise. More... | |
int | Rast3d_tile_in_range (RASTER3D_Map *map, int x, int y, int z) |
Returns 1 if tile-coordinate (x, y, z) is a coordinate inside tile cube. Returns 0 otherwise. More... | |
int | Rast3d_compute_clipped_tile_dimensions (RASTER3D_Map *map, int tileIndex, int *rows, int *cols, int *depths, int *xRedundant, int *yRedundant, int *zRedundant) |
Computes the dimensions of the tile when clipped to fit the region of map. The clipped dimensions are returned in rows, cols, depths. The complement is returned in xRedundant, yRedundant, and zRedundant. This function returns the number of cells in the clipped tile. More... | |
void | Rast3d_compute_optimal_tile_dimension (RASTER3D_Region *region, int type, int *tileX, int *tileY, int *tileZ, int maxSize) |
Compute the optimal tile size. More... | |
int Rast3d_compute_clipped_tile_dimensions | ( | RASTER3D_Map * | map, |
int | tileIndex, | ||
int * | rows, | ||
int * | cols, | ||
int * | depths, | ||
int * | xRedundant, | ||
int * | yRedundant, | ||
int * | zRedundant | ||
) |
Computes the dimensions of the tile when clipped to fit the region of map. The clipped dimensions are returned in rows, cols, depths. The complement is returned in xRedundant, yRedundant, and zRedundant. This function returns the number of cells in the clipped tile.
map | |
tileIndex | |
rows | |
cols | |
depths | |
xRedundant | |
yRedundant | |
zRedundant |
Definition at line 253 of file tilemath.c.
References RASTER3D_Map::clipX, RASTER3D_Map::clipY, RASTER3D_Map::clipZ, RASTER3D_Region::cols, RASTER3D_Region::depths, Rast3d_tile_index2tile(), RASTER3D_Map::region, RASTER3D_Region::rows, RASTER3D_Map::tileSize, RASTER3D_Map::tileX, RASTER3D_Map::tileY, RASTER3D_Map::tileZ, and x.
Referenced by Rast3d_init_index().
void Rast3d_compute_optimal_tile_dimension | ( | RASTER3D_Region * | region, |
int | type, | ||
int * | tileX, | ||
int * | tileY, | ||
int * | tileZ, | ||
int | maxSize | ||
) |
Compute the optimal tile size.
This function computes tile sizes with an optimal ratio between tile dimensions and minimized border tile overlapping. Large dimensions (in most cases x and y) will be reduced more often than small dimensions to fit the maxSize criteria.
region | The region of the map |
type | The type of the map (FCELL_TYPE or DCELL_TYPE) |
tileX | Pointer of the tile size in x direction for result storage |
tileY | Pointer of the tile size in y direction for result storage |
tileZ | Pointer of the tile size in z direction for result storage |
maxSize | The max size of the tile in kilo bytes |
Definition at line 317 of file tilemath.c.
void Rast3d_coord2tile_coord | ( | RASTER3D_Map * | map, |
int | x, | ||
int | y, | ||
int | z, | ||
int * | xTile, | ||
int * | yTile, | ||
int * | zTile, | ||
int * | xOffs, | ||
int * | yOffs, | ||
int * | zOffs | ||
) |
Converts cell-coordinates (x, y, z) into tile-coordinates (xTile, yTile, zTile) and the coordinate of the cell (xOffs, yOffs, zOffs) within the tile.
map | |
x | |
y | |
z | |
xTile | |
yTile | |
zTile | |
xOffs | |
yOffs | |
zOffs |
Definition at line 129 of file tilemath.c.
References RASTER3D_Map::tileX, RASTER3D_Map::tileY, RASTER3D_Map::tileZ, and x.
Referenced by Rast3d_coord2tile_index(), and Rast3d_flush_tiles_in_cube().
void Rast3d_coord2tile_index | ( | RASTER3D_Map * | map, |
int | x, | ||
int | y, | ||
int | z, | ||
int * | tileIndex, | ||
int * | offset | ||
) |
Converts cell-coordinates (x, y, z) into tileIndex and the offset of the cell within the tile.
map | |
x | |
y | |
z | |
tileIndex | |
offset |
Definition at line 158 of file tilemath.c.
References Rast3d_coord2tile_coord(), Rast3d_tile2tile_index(), RASTER3D_Map::tileX, RASTER3D_Map::tileXY, and x.
Referenced by Rast3d_get_double_region(), Rast3d_get_float_region(), Rast3d_put_double(), and Rast3d_put_float().
int Rast3d_coord_in_range | ( | RASTER3D_Map * | map, |
int | x, | ||
int | y, | ||
int | z | ||
) |
Returns 1 if cell-coordinate (x, y, z) is a coordinate inside the region. Returns 0 otherwise.
map | |
x | |
y | |
z |
Definition at line 185 of file tilemath.c.
References RASTER3D_Region::cols, RASTER3D_Region::depths, RASTER3D_Map::region, RASTER3D_Region::rows, and x.
int Rast3d_tile2tile_index | ( | RASTER3D_Map * | map, |
int | xTile, | ||
int | yTile, | ||
int | zTile | ||
) |
Returns tile-index corresponding to tile-coordinates (xTile, yTile, zTile).
map | |
xTile | |
yTile | |
zTile |
Definition at line 49 of file tilemath.c.
References RASTER3D_Map::nx, and RASTER3D_Map::nxy.
Referenced by Rast3d_coord2tile_index(), and Rast3d_flush_tile_cube().
void Rast3d_tile_coord_origin | ( | RASTER3D_Map * | map, |
int | xTile, | ||
int | yTile, | ||
int | zTile, | ||
int * | x, | ||
int * | y, | ||
int * | z | ||
) |
Computes the cell-coordinates (x, y, z) which correspond to the origin of the tile with tile-coordinates (xTile, yTile, zTile).
map | |
xTile | |
yTile | |
zTile | |
x | |
y | |
z |
Definition at line 73 of file tilemath.c.
References RASTER3D_Map::tileX, RASTER3D_Map::tileY, RASTER3D_Map::tileZ, and x.
Referenced by Rast3d_tile_index_origin().
int Rast3d_tile_in_range | ( | RASTER3D_Map * | map, |
int | x, | ||
int | y, | ||
int | z | ||
) |
Returns 1 if tile-coordinate (x, y, z) is a coordinate inside tile cube. Returns 0 otherwise.
map | |
x | |
y | |
z |
Definition at line 225 of file tilemath.c.
References RASTER3D_Map::nx, RASTER3D_Map::ny, RASTER3D_Map::nz, and x.
void Rast3d_tile_index2tile | ( | RASTER3D_Map * | map, |
int | tileIndex, | ||
int * | xTile, | ||
int * | yTile, | ||
int * | zTile | ||
) |
Converts index tileIndex into tile-coordinates (xTile, yTile, zTile).
map | |
tileIndex | |
xTile | |
yTile | |
zTile |
Definition at line 23 of file tilemath.c.
References RASTER3D_Map::nx, and RASTER3D_Map::nxy.
Referenced by Rast3d_compute_clipped_tile_dimensions(), and Rast3d_tile_index_origin().
int Rast3d_tile_index_in_range | ( | RASTER3D_Map * | map, |
int | tileIndex | ||
) |
Returns 1 if tileIndex is a valid index for map. Returns 0 otherwise.
map | |
tileIndex |
Definition at line 204 of file tilemath.c.
void Rast3d_tile_index_origin | ( | RASTER3D_Map * | map, |
int | tileIndex, | ||
int * | x, | ||
int * | y, | ||
int * | z | ||
) |
Computes the cell-coordinates (x, y, z) which correspond to the origin of the tile with tileIndex.
map | |
tileIndex | |
x | |
y | |
z |
Definition at line 97 of file tilemath.c.
References Rast3d_tile_coord_origin(), Rast3d_tile_index2tile(), and x.