3 #include <grass/glocale.h>
46 param->
type->key =
"type";
47 param->
type->type = TYPE_STRING;
48 param->
type->required = NO;
49 param->
type->multiple = NO;
50 param->
type->answer =
"default";
51 param->
type->options =
"default,double,float";
52 param->
type->description = _(
"Data type used in the output file");
61 _(
"Precision used in the output file (default, max, or 0 to 52)");
71 _(
"The compression method used in the output file");
81 _(
"The dimensions of the tiles used in the output file");
87 int *useLzwDefault,
int *doLzw,
88 int *useRleDefault,
int *doRle,
89 int *usePrecisionDefault,
int *precision,
90 int *useDimensionDefault,
int *tileX,
int *tileY,
95 *useTypeDefault = *useLzwDefault = *useRleDefault = 0;
96 *usePrecisionDefault = *useDimensionDefault = 0;
100 if (strcmp(param->
type->answer,
"double") == 0)
102 else if (strcmp(param->
type->answer,
"float") == 0)
111 if (strcmp(param->
precision->answer,
"default") != 0) {
112 if (strcmp(param->
precision->answer,
"max") == 0)
114 else if ((sscanf(param->
precision->answer,
"%d", precision) != 1) ||
116 G3d_error(_(
"G3d_getStandard3dParams: precision value invalid"));
121 *usePrecisionDefault = 1;
124 if (strcmp(param->
compression->answer,
"default") != 0) {
125 if (strcmp(param->
compression->answer,
"rle") == 0) {
126 *doRle = G3D_USE_RLE;
129 else if (strcmp(param->
compression->answer,
"lzw") == 0) {
131 *doLzw = G3D_USE_LZW;
133 else if (strcmp(param->
compression->answer,
"rle+lzw") == 0) {
134 *doRle = G3D_USE_RLE;
135 *doLzw = G3D_USE_LZW;
143 *useLzwDefault = *useRleDefault = 1;
146 if (strcmp(param->
dimension->answer,
"default") != 0) {
147 if (sscanf(param->
dimension->answer,
"%dx%dx%d",
148 tileX, tileY, tileZ) != 3) {
149 G3d_error(_(
"G3d_getStandard3dParams: tile dimension value invalid"));
154 *useDimensionDefault = 1;
163 static struct Option *windowParam =
NULL;
168 windowParam->key =
"region3";
169 windowParam->type = TYPE_STRING;
170 windowParam->required = NO;
171 windowParam->multiple = NO;
172 windowParam->answer =
NULL;
173 windowParam->description = _(
"Window replacing the default");
180 if (windowParam ==
NULL)
182 if (windowParam->answer ==
NULL)
184 if (strcmp(windowParam->answer, G3D_WINDOW_ELEMENT) == 0)
185 return G_store(G3D_WINDOW_ELEMENT);
186 return G_store(windowParam->answer);
char * G_store(const char *s)
Copy string to allocated memory.
void G3d_free(void *buf)
Same as free (ptr).
void G3d_error(const char *msg,...)
struct Option * precision
void G3d_getCompressionMode(int *doCompress, int *doLzw, int *doRle, int *precision)
struct Option * G_define_option(void)
Initializes an Option struct.
void G3d_getTileDimension(int *tileX, int *tileY, int *tileZ)
get Tile Dimension
char * G3d_getWindowParams(void)
struct Option * compression
void G3d_setStandard3dInputParams()
Initializes a parameter structure for the subset of command line arguments which lets the user overwr...
struct Option * dimension
void * G3d_malloc(int nBytes)
Same as malloc (nBytes), except that in case of error G3d_error() is invoked.
void G3d_initDefaults(void)
Initializes the default values described in G3D Defaults. Applications have to use this function only...
int G3d_getStandard3dParams(int *useTypeDefault, int *type, int *useLzwDefault, int *doLzw, int *useRleDefault, int *doRle, int *usePrecisionDefault, int *precision, int *useDimensionDefault, int *tileX, int *tileY, int *tileZ)
void G3d_setWindowParams(void)
int G3d_getFileType()
get G3d file type