00001 #include <grass/config.h>
00002 #include <grass/gis.h>
00003 #include <rpc/types.h>
00004 #include <rpc/xdr.h>
00005 #ifdef HAVE_GDAL
00006 #include <gdal.h>
00007 #endif
00008
00009 #define XDR_FLOAT_NBYTES 4
00010 #define XDR_DOUBLE_NBYTES 8
00011 #define NULL_ROWS_INMEM 8
00012
00013
00014
00015
00016
00017
00018
00019 typedef int COLUMN_MAPPING;
00020
00021 struct GDAL_link
00022 {
00023 char *filename;
00024 int band_num;
00025 DCELL null_val;
00026 #ifdef HAVE_GDAL
00027 GDALDatasetH data;
00028 GDALRasterBandH band;
00029 GDALDataType type;
00030 #endif
00031 };
00032
00033 #ifdef HAVE_GDAL
00034 extern CPLErr G_gdal_raster_IO(
00035 GDALRasterBandH, GDALRWFlag,
00036 int, int, int, int,
00037 void *, int, int, GDALDataType,
00038 int, int);
00039 #endif
00040
00041 struct fileinfo
00042 {
00043 int open_mode;
00044 struct Cell_head cellhd;
00045 struct Reclass reclass;
00046 struct Cell_stats statf;
00047 struct Range range;
00048 struct FPRange fp_range;
00049 int want_histogram;
00050 int reclass_flag;
00051 off_t *row_ptr;
00052 COLUMN_MAPPING *col_map;
00053 double C1, C2;
00054 int cur_row;
00055 int null_cur_row;
00056 int cur_nbytes;
00057 unsigned char *data;
00058 int nbytes;
00059 RASTER_MAP_TYPE map_type;
00060 char *temp_name;
00061 char *null_temp_name;
00062 int null_file_exists;
00063 char *name;
00064 char *mapset;
00065 int io_error;
00066 XDR xdrstream;
00067 unsigned char *NULL_ROWS[NULL_ROWS_INMEM];
00068 unsigned char *null_work_buf;
00069 int min_null_row;
00070 struct Quant quant;
00071 struct GDAL_link *gdal;
00072 };
00073
00074 struct G__
00075 {
00076 int fp_nbytes;
00077 RASTER_MAP_TYPE fp_type;
00078 struct Cell_head window;
00079 int window_set;
00080 int mask_fd;
00081 int auto_mask;
00082 CELL *mask_buf;
00083 char *null_buf;
00084 CELL *temp_buf;
00085 unsigned char *compressed_buf;
00086 int compressed_buf_size;
00087 unsigned char *work_buf;
00088 int work_buf_size;
00089 int null_buf_size;
00090 int mask_buf_size;
00091 int temp_buf_size;
00092 int want_histogram;
00093
00094 int fileinfo_count;
00095 struct fileinfo *fileinfo;
00096 };
00097
00098 extern struct G__ G__;
00099
00100 #define OPEN_OLD 1
00101 #define OPEN_NEW_COMPRESSED 2
00102 #define OPEN_NEW_UNCOMPRESSED 3
00103 #define OPEN_NEW_RANDOM 4