33 #include <grass/gis.h>
34 #include <grass/glocale.h>
37 #define FORMAT_FILE "f_format"
38 #define QUANT_FILE "f_quant"
39 #define NULL_FILE "null"
41 static int close_old(
int);
42 static int close_new(
int,
int);
43 static char CELL_DIR[100];
80 return close_new(fd, 1);
111 return close_old(fd);
113 return close_new(fd, 0);
116 static int close_old(
int fd)
135 if (fcb->
cellhd.compressed)
154 static int close_new(
int fd,
int ok)
158 struct Categories cats;
160 char path[GPATH_MAX];
161 CELL cell_min, cell_max;
162 int row, i, open_mode;
180 for (row = fcb->
cur_row; row < fcb->cellhd.rows; row++)
204 for (row = fcb->
min_null_row; row < fcb->null_cur_row; row++)
207 row, fcb->
cellhd.cols, fd);
213 for (row = fcb->
null_cur_row; row < fcb->cellhd.rows; row++)
220 G_warning(_(
"closecell: can't move [%s] to null-cells file [%s]"),
242 G_warning(_(
"Error writing floating point format file for map %s"),
253 strcpy(CELL_DIR,
"fcell");
263 strcpy(CELL_DIR,
"cell");
291 G_warning(_(
"closecell: can't move [%s] to cell file [%s]"),
346 G_warning(_(
"Unable to write quant file!"));
392 struct Key_Value *format_kv;
393 char path[GPATH_MAX];
397 G_warning(_(
"Unable to write f_format file for CELL maps"));
char * G_mapset(void)
current mapset name
int G_is_c_null_value(const CELL *cellVal)
Returns 1 if cell is NULL, 0 otherwise. This will test if the value cell is the largest int...
int G_free_cell_stats(struct Cell_stats *s)
free cell stats
int G_put_raster_row(int fd, const void *buf, RASTER_MAP_TYPE data_type)
int G_short_history(const char *name, const char *type, struct History *hist)
initialize history structure
void G_free(void *buf)
Free allocated memory.
void G_quant_free(struct Quant *q)
char * G__file_name_misc(char *path, const char *dir, const char *element, const char *name, const char *mapset)
int G_close_cell(int fd)
close a raster map
int G__open_null_write(int fd)
int G_write_cats(char *name, struct Categories *cats)
write raster category file
int G_init_cats(CELL num, const char *title, struct Categories *pcats)
initialize category structure
int G__write_fp_format(int fd)
int G_write_fp_range(const char *name, const struct FPRange *range)
Write the floating point range file f_range. This file is written in binary using XDR format...
unsigned char * null_work_buf
int G_free_key_value(struct Key_Value *kv)
Free allocated Key_Value structure.
int G_zero_raster_buf(void *rast, RASTER_MAP_TYPE data_type)
Zero a raster buffer.
int G_write_histogram_cs(const char *name, struct Cell_stats *statf)
Writes the histogram based on cell statistics to file.
int G_write_history(const char *name, struct History *hist)
write raster history file
#define OPEN_NEW_UNCOMPRESSED
int G_remove_histogram(const char *name)
Removes the histogram.
int G_free_cats(struct Categories *pcats)
free category structure memory
int G_put_cellhd(const char *name, struct Cell_head *cellhd)
int G_get_range_min_max(const struct Range *range, CELL *min, CELL *max)
get range min and max
char * G__file_name(char *path, const char *element, const char *name, const char *mapset)
Builds full path names to GIS data files.
int G__write_null_bits(int null_fd, const unsigned char *flags, int row, int cols, int fd)
int G_unopen_cell(int fd)
unopen a raster map
int G__init_null_bits(unsigned char *flags, int cols)
void G_close_gdal_link(struct GDAL_link *gdal)
int G__make_mapset_element_misc(const char *dir, const char *name)
Create misc element in the current mapset.
struct fileinfo * fileinfo
int G_free_reclass(struct Reclass *reclass)
int G_write_key_value_file(const char *file, const struct Key_Value *kv, int *stat)
Write key/value pairs to file.
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
int G_construct_default_range(struct Range *range)
Sets the integer range r to [1,255].
int G_debug(int level, const char *msg,...)
Print debugging message.
int G__make_mapset_element(const char *p_element)
Create element in the current mapset.
int G__remove_fp_range(const char *name)
int G_write_quant(const char *name, const char *mapset, const struct Quant *quant)
Writes the f_quant file for the raster map name from q. if mapset==G_mapset() i.e. the map is in current mapset, then the original quant file in cell_misc/map/f_quant is written. Otherwise q is written into quant2/mapset/name (much like colr2 element). This results in map being read using quant rules stored in q from G_mapset(). See G_read_quant() for detailes.
unsigned char * NULL_ROWS[NULL_ROWS_INMEM]
int G_remove_colors(const char *name, const char *mapset)
int G_write_range(const char *name, const struct Range *range)
write raster range file
int G_set_key_value(const char *key, const char *value, struct Key_Value *kv)
Set value for given key.
int G_quant_round(struct Quant *quant)
#define OPEN_NEW_COMPRESSED
struct Key_Value * G_create_key_value(void)
Allocate and initialize Key_Value structure.