2
#include "ply_to_cll.h"
10
#define FGET gets(buffer)
11
#define READLINE if (FGET==NULL) quit() ;\
12
sscanf (buffer,"%d%d%d%d",\
13
&cur_row, &col_b, &col_e, &cat)
19
struct Cell_head wind ;
20
char buffer[MAXLINE] ;
24
int cur_row, col_b, col_e ;
25
int num_rows, num_cols ;
32
G_gisinit("bmif_to_cell") ;
38
if ((num_rows*num_cols) <= 0)
41
" READ ERROR: bmif_to_cell receiving bad header info\n") ;
46
wind.rows = num_rows ;
47
wind.cols = num_cols ;
50
wind.north = (double)wind.rows ;
52
wind.east = (double)wind.cols ;
56
record = G_allocate_cell_buf() ;
58
if ( (newmap = G_open_cell_new(argv[1],"") ) == -1)
60
fprintf("bmif_to_cell error: can't open raster map %s\n", argv[1]) ;
66
/* Loop for all data rows */
67
for(atrow=0; atrow<num_rows; atrow++)
69
/* zero the output buffer array */
71
for(atcol=0; atcol<num_cols; atcol++)
74
/* If we've hit the end of the file, write out some zero rows and quit */
75
if (cur_row > num_rows)
77
while (atrow < num_rows)
79
G_put_map_row(newmap, record) ;
82
G_close_cell(newmap) ;
86
/* write out enough rows to get to current row */
87
while (atrow < cur_row + ROW_SHIFT)
89
G_put_map_row(newmap, record) ;
95
col_ptr = record + col_b ;
96
for(atcol=col_b; atcol<=col_e; atcol++)
97
*(col_ptr++) = (CELL)cat ;
99
} while (cur_row == (atrow - ROW_SHIFT)) ;
101
G_put_map_row(newmap, record) ;
103
fprintf(stderr, "Close: %d\n", G_close_cell(newmap)) ;
108
fprintf(stderr," You drew a region outside the mask; restart REGIONS setup\n") ;