GRASS 8 Programmer's Manual 8.6.0dev(2026)-f6f2c534ea
Loading...
Searching...
No Matches
open2.c
Go to the documentation of this file.
1#include <grass/gis.h>
2#include <grass/raster3d.h>
3
4/*----------------------------------------------------------------------------*/
5
6/*!
7 * \brief
8 *
9 * Opens new g3d-file with <em>name</em> in the current mapset. Tiles
10 * are stored in memory with <em>typeIntern</em> which must be one of
11 * FCELL_TYPE, DCELL_TYPE, or RASTER3D_TILE_SAME_AS_FILE. <em>cache</em>
12 * specifies the cache-mode used and must be either RASTER3D_NO_CACHE,
13 * RASTER3D_USE_CACHE_DEFAULT, RASTER3D_USE_CACHE_X, RASTER3D_USE_CACHE_Y,
14 * RASTER3D_USE_CACHE_Z, RASTER3D_USE_CACHE_XY, RASTER3D_USE_CACHE_XZ,
15 * RASTER3D_USE_CACHE_YZ, RASTER3D_USE_CACHE_XYZ, the result of
16 * <tt>Rast3d_cache_size_encode ()</tt> (cf.{g3d:G3d.cacheSizeEncode}), or any
17 * positive integer which specifies the number of tiles buffered in the cache.
18 * <em>region</em> specifies the 3d region. The map is created using the
19 * <em>type</em> which must be of FCELL_TYPE or DCELL_TYPE. The methods for
20 * compression can be specified LZW or RLE. The digits of the floating point
21 * mantissa can be specified. In case of FCELL_TYPE 0-23 and 0-52 in case of
22 * DCELL_TYPE. The number cells in X, Y and Z direction defines the size of each
23 * tile. Returns a pointer to the cell structure ... if successful, NULL ...
24 * otherwise.
25 *
26 * \param name The name of the map
27 * \param typeIntern The internal storage type for in memory cached tiles
28 * \param cache The type of the caching
29 * \param region The region of the map
30 * \param type The type of the map (FCELL_TYPE, or DCELL_TYPE)
31 * \param compression
32 * \param doLzw Use the LZW compression algorithm
33 * \param doRle Use the Run-Length-Encoding algorithm for compression
34 * \param precision The precision used for the mantissa (0 - 52) or
35 * RASTER3D_MAX_PRECISION
36 * \param tileX The number of cells in X direction of a tile
37 * \param tileY The number of cells in Y direction of a tile
38 * \param tileZ The number of cells in Z direction of a tile
39 * \return void *
40 */
41void *Rast3d_open_new_param(const char *name, int typeIntern, int cache,
42 RASTER3D_Region *region, int type, int compression,
43 int precision, int tileX, int tileY, int tileZ)
44{
45 void *map;
47 int oldType;
48
50
53
55 Rast3d_set_tile_dimension(tileX, tileY, tileZ);
56
59
60 map = Rast3d_open_cell_new(name, typeIntern, cache, region);
61
65
66 return map;
67}
68
69/*----------------------------------------------------------------------------*/
70
71/*!
72 * \brief
73 *
74 * Opens new g3d-file with <em>name</em> in the current mapset. This method
75 * tries to compute optimal tile size based on the number of rows, cols and
76 * depths and the maximum allowed tile size in KB. Tiles are stored in memory
77 * using RASTER3D_TILE_SAME_AS_FILE method. <em>cache</em> specifies the
78 * cache-mode used and must be either RASTER3D_NO_CACHE,
79 * RASTER3D_USE_CACHE_DEFAULT, RASTER3D_USE_CACHE_X, RASTER3D_USE_CACHE_Y,
80 * RASTER3D_USE_CACHE_Z, RASTER3D_USE_CACHE_XY, RASTER3D_USE_CACHE_XZ,
81 * RASTER3D_USE_CACHE_YZ, RASTER3D_USE_CACHE_XYZ, the result of
82 * <tt>Rast3d_cache_size_encode ()</tt> (cf.{g3d:G3d.cacheSizeEncode}), or any
83 * positive integer which specifies the number of tiles buffered in the cache.
84 * <em>region</em> specifies the 3d region. The map is created using the
85 * <em>type</em> which must be of FCELL_TYPE or DCELL_TYPE. Returns a pointer to
86 * the cell structure ... if successful, NULL ... otherwise.
87 *
88 * \param name The name of the map
89 * \param cache The type of the caching
90 * \param region The region of the map
91 * \param type The type of the map (FCELL_TYPE, or DCELL_TYPE)
92 * \param maxSize The maximum size of a tile in kilo bytes
93 * \return void *
94 */
95void *Rast3d_open_new_opt_tile_size(const char *name, int cache,
96 RASTER3D_Region *region, int type,
97 int maxSize)
98{
99 void *map;
101 int tileX, tileY, tileZ;
102
104
106
107 Rast3d_compute_optimal_tile_dimension(region, type, &tileX, &tileY, &tileZ,
108 maxSize);
109
110 G_debug(1, "New tile dimension X %i Y %i Z %i\n", tileX, tileY, tileZ);
111
112 Rast3d_set_tile_dimension(tileX, tileY, tileZ);
113
116
118
121
122 return map;
123}
int G_debug(int, const char *,...) __attribute__((format(printf
void Rast3d_compute_optimal_tile_dimension(RASTER3D_Region *, int, int *, int *, int *, int)
Compute the optimal tile size.
Definition tilemath.c:306
void Rast3d_get_tile_dimension(int *, int *, int *)
get Tile Dimension
Definition defaults.c:252
void Rast3d_set_tile_dimension(int, int, int)
set Tile Dimension
Definition defaults.c:227
void * Rast3d_open_cell_new(const char *, int, int, RASTER3D_Region *)
Opens new g3d-file with name in the current mapset. Tiles are stored in memory with type which must b...
void Rast3d_set_file_type(int)
set G3d file type
Definition defaults.c:197
int Rast3d_get_file_type(void)
get G3d file type
Definition defaults.c:212
void Rast3d_get_compression_mode(int *, int *)
Gets compression mode.
Definition defaults.c:125
void Rast3d_init_defaults(void)
Initializes the default values described in RASTER3D Defaults. Applications have to use this function...
Definition defaults.c:282
void Rast3d_set_compression_mode(int, int)
set compression mode
Definition defaults.c:93
unsigned short compression
Definition gsd_img_tif.c:42
const char * name
Definition named_colr.c:6
void * Rast3d_open_new_opt_tile_size(const char *name, int cache, RASTER3D_Region *region, int type, int maxSize)
Opens new g3d-file with name in the current mapset. This method tries to compute optimal tile size ba...
Definition open2.c:95
void * Rast3d_open_new_param(const char *name, int typeIntern, int cache, RASTER3D_Region *region, int type, int compression, int precision, int tileX, int tileY, int tileZ)
Opens new g3d-file with name in the current mapset. Tiles are stored in memory with typeIntern which ...
Definition open2.c:41
#define RASTER3D_TILE_SAME_AS_FILE
Definition raster3d.h:11