12 static int G3d_closeNew(G3D_Map * map)
15 struct Categories cats;
31 G3d_error(
"G3d_closeNew: can't write raster3d history");
40 G3d_filename(path, G3D_CELL_ELEMENT, map->fileName, map->mapset);
42 if (CopyFile(map->tempName, path,
FALSE) == 0) {
44 if (
link(map->tempName, path) < 0) {
46 if (rename(map->tempName, path)) {
48 (
"G3d_closeNew: can't move temp raster map %s\nto 3d data file %s",
54 remove(map->tempName);
61 static int G3d_closeCellNew(G3D_Map * map)
67 G3d_error(
"G3d_closeCellNew: error in G3d_flushAllTiles");
72 G3d_error(
"G3d_closeCellNew: error in G3d_flushIndex");
79 if (lseek(map->data_fd,
80 (
long)(map->offset -
sizeof(
int) -
sizeof(
long)),
82 G3d_error(
"G3d_closeCellNew: can't position file");
86 if (!
G3d_writeInts(map->data_fd, map->useXdr, &(map->indexNbytesUsed), 1)) {
87 G3d_error(
"G3d_closeCellNew: can't write header");
92 if (write(map->data_fd, <mp,
sizeof(
long)) !=
sizeof(
long)) {
93 G3d_error(
"G3d_closeCellNew: can't write header");
97 if (!G3d_closeNew(map) != 0) {
98 G3d_error(
"G3d_closeCellNew: error in G3d_closeNew");
107 static int G3d_closeOld(G3D_Map * map)
109 if (close(map->data_fd) != 0) {
110 G3d_error(
"G3d_closeOld: could not close file");
119 static int G3d_closeCellOld(G3D_Map * map)
121 if (!G3d_closeOld(map) != 0) {
122 G3d_error(
"G3d_closeCellOld: error in G3d_closeOld");
147 if (!G3d_closeCellNew(map)) {
148 G3d_error(
"G3d_closeCell: error in G3d_closeCellNew");
153 if (!G3d_closeCellOld(map) != 0) {
154 G3d_error(
"G3d_closeCell: error in G3d_closeCellOld");
164 G3d_error(
"G3d_closeCell: error in G3d_disposeCache");
173 map->region.proj, map->region.zone,
174 map->region.north, map->region.south,
175 map->region.east, map->region.west,
176 map->region.top, map->region.bottom,
177 map->region.rows, map->region.cols,
179 map->region.ew_res, map->region.ns_res,
181 map->tileX, map->tileY, map->tileZ,
183 map->compression, map->useRle, map->useLzw,
184 map->precision, map->offset, map->useXdr,
185 map->hasIndex, map->unit)) {
186 G3d_error(
"G3d_closeCell: error in G3d_writeHeader");
int G_short_history(const char *name, const char *type, struct History *hist)
initialize history structure
int G3d_disposeCache(G3D_Map *map)
void G3d_free(void *buf)
Same as free (ptr).
void G3d_error(const char *msg,...)
int G3d_flushAllTiles(G3D_Map *map)
int G3d_range_write(G3D_Map *map)
Writes the range which is stored in the range structure of map. (This function is invoked automatical...
void G3d_filename(char *path, const char *elementName, const char *mapName, const char *mapset)
int G_free_cats(struct Categories *pcats)
free category structure memory
int G_command_history(struct History *hist)
Save command line to raster history structure.
int G3d_writeInts(int fd, int useXdr, const int *i, int nofNum)
int G3d_removeColor(const char *name)
int G_init_raster_cats(const char *title, struct Categories *pcats)
Same as existing G_init_raster_cats() only ncats argument is missign. ncats has no meaning in new Cat...
int G3d_closeCell(G3D_Map *map)
Closes g3d-file. If map is new and cache-mode is used for map then every tile which is not flushed be...
int G3d_longEncode(long *source, unsigned char *dst, int nofNums)
int G3d_flushIndex(G3D_Map *map)
int G3d_writeHistory(const char *name, struct History *hist)
write raster3d History file
int G3d_writeCats(const char *name, struct Categories *cats)
Writes the categories stored in the cats structure into the categories file for map name in the curre...