1 #include <grass/config.h> 2 #include <grass/gis.h> 3 #ifdef HAVE_GDAL 4 #include <gdal.h> 5 #endif 6 7 #define XDR_FLOAT_NBYTES 4 8 #define XDR_DOUBLE_NBYTES 8 9 #define NULL_ROWS_INMEM 8 10 11 /* if short is 16 bits, then 12 * short will allow 32767 cols 13 * unsigned short will allow 65536 cols 14 * use int if you need more columns (but this will take more memory). 15 * 16 */ 17 typedef int COLUMN_MAPPING; 18 19 struct GDAL_link 20 { 21 char *filename; 22 int band_num; 23 DCELL null_val; 24 int hflip; 25 int vflip; 26 #ifdef HAVE_GDAL 27 GDALDatasetH data; 28 GDALRasterBandH band; 29 GDALDataType type; 30 #endif 31 }; 32 33 #ifdef HAVE_GDAL 34 extern CPLErr Rast_gdal_raster_IO(GDALRasterBandH, GDALRWFlag, 35 int, int, int, int, 36 void *, int, int, GDALDataType, int, int); 37 #endif 38 39 struct tileinfo /* Information for tiles */ 40 { 41 char *name; /* Name of open file */ 42 char *mapset; /* Mapset of open file */ 43 struct Cell_head cellhd; /* Cell header */ 44 struct ilist *clist; /* columns inside current region */ 45 }; 46 47 struct R_vrt 48 { 49 int tilecount; 50 struct tileinfo *tileinfo; 51 struct ilist *tlist; 52 }; 53 54 struct fileinfo /* Information for opened cell files */ 55 { 56 int open_mode; /* see defines below */ 57 struct Cell_head cellhd; /* Cell header */ 58 struct Reclass reclass; /* Table reclass */ 59 struct Cell_stats statf; /* Cell stats */ 60 struct Range range; /* Range structure */ 61 struct FPRange fp_range; /* float Range structure */ 62 int want_histogram; 63 int reclass_flag; /* Automatic reclass flag */ 64 off_t *row_ptr; /* File row addresses */ 65 COLUMN_MAPPING *col_map; /* Data to window col mapping */ 66 double C1, C2; /* Data to window row constants */ 67 int cur_row; /* Current data row in memory */ 68 int null_cur_row; /* Current null row in memory */ 69 int cur_nbytes; /* nbytes per cell for current row */ 70 unsigned char *data; /* Decompressed data buffer */ 71 int null_fd; /* Null bitmap fd */ 72 unsigned char *null_bits; /* Null bitmap buffer */ 73 int nbytes; /* bytes per cell */ 74 RASTER_MAP_TYPE map_type; /* type: int, float or double map */ 75 char *temp_name; /* Temporary name for NEW files */ 76 char *null_temp_name; /* Temporary name for NEW NULL files */ 77 int null_file_exists; /* for existing raster maps */ 78 char *name; /* Name of open file */ 79 char *mapset; /* Mapset of open file */ 80 int io_error; /* io error warning given */ 81 struct Quant quant; 82 struct GDAL_link *gdal; 83 int data_fd; /* Raster data fd */ 84 off_t *null_row_ptr; /* Null file row addresses */ 85 struct R_vrt *vrt; 86 }; 87 88 struct R__ /* Structure of library globals */ 89 { 90 RASTER_MAP_TYPE fp_type; /* type for writing floating maps */ 91 int mask_fd; /* File descriptor for automatic mask */ 92 int auto_mask; /* Flag denoting automatic masking */ 93 int want_histogram; 94 int nbytes; 95 int compression_type; 96 int compress_nulls; 97 int window_set; /* Flag: window set? */ 98 int split_window; /* Separate windows for input and output */ 99 struct Cell_head rd_window; /* Window used for input */ 100 struct Cell_head wr_window; /* Window used for output */ 101 102 int fileinfo_count; 103 struct fileinfo *fileinfo; 104 }; 105 106 extern struct R__ R__; /* allocated in init */ 107 108 #define OPEN_OLD 1 109 #define OPEN_NEW_COMPRESSED 2 110 #define OPEN_NEW_UNCOMPRESSED 3 111