GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
G.h
Go to the documentation of this file.
1 #include <grass/config.h>
2 #include <grass/gis.h>
3 #include <rpc/types.h>
4 #include <rpc/xdr.h>
5 #ifdef HAVE_GDAL
6 #include <gdal.h>
7 #endif
8 
9 #define XDR_FLOAT_NBYTES 4
10 #define XDR_DOUBLE_NBYTES 8
11 #define NULL_ROWS_INMEM 8
12 
13 /* if short is 16 bits, then
14  * short will allow 32767 cols
15  * unsigned short will allow 65536 cols
16  * use int if you need more columns (but this will take more memory).
17  *
18  */
19 typedef int COLUMN_MAPPING;
20 
21 struct GDAL_link
22 {
23  char *filename;
24  int band_num;
25  DCELL null_val;
26 #ifdef HAVE_GDAL
27  GDALDatasetH data;
28  GDALRasterBandH band;
29  GDALDataType type;
30 #endif
31 };
32 
33 #ifdef HAVE_GDAL
34 extern CPLErr G_gdal_raster_IO(
35  GDALRasterBandH, GDALRWFlag,
36  int, int, int, int,
37  void *, int, int, GDALDataType,
38  int, int);
39 #endif
40 
41 struct fileinfo /* Information for opened cell files */
42 {
43  int open_mode; /* see defines below */
44  struct Cell_head cellhd; /* Cell header */
45  struct Reclass reclass; /* Table reclass */
46  struct Cell_stats statf; /* Cell stats */
47  struct Range range; /* Range structure */
48  struct FPRange fp_range; /* float Range structure */
50  int reclass_flag; /* Automatic reclass flag */
51  off_t *row_ptr; /* File row addresses */
52  COLUMN_MAPPING *col_map; /* Data to window col mapping */
53  double C1, C2; /* Data to window row constants */
54  int cur_row; /* Current data row in memory */
55  int null_cur_row; /* Current null row in memory */
56  int cur_nbytes; /* nbytes per cell for current row */
57  unsigned char *data; /* Decompressed data buffer */
58  int nbytes; /* bytes per cell */
59  RASTER_MAP_TYPE map_type; /* type: int, float or double map */
60  char *temp_name; /* Temporary name for NEW files */
61  char *null_temp_name; /* Temporary name for NEW NULL files */
62  int null_file_exists; /* for existing raster maps */
63  char *name; /* Name of open file */
64  char *mapset; /* Mapset of open file */
65  int io_error; /* io error warning given */
66  XDR xdrstream; /* xdr stream for reading fp */
67  unsigned char *NULL_ROWS[NULL_ROWS_INMEM];
68  unsigned char *null_work_buf; /* data buffer for reading null rows */
69  int min_null_row; /* Minimum row null row number in memory */
70  struct Quant quant;
71  struct GDAL_link *gdal;
72 };
73 
74 struct G__ /* Structure of library globals */
75 {
76  int fp_nbytes; /* size of cell in floating maps */
77  RASTER_MAP_TYPE fp_type; /* type for writing floating maps */
78  struct Cell_head window; /* Contains the current window */
79  int window_set; /* Flag: window set? */
80  int mask_fd; /* File descriptor for automatic mask */
81  int auto_mask; /* Flag denoting automatic masking */
82  CELL *mask_buf;
83  char *null_buf; /* buffer for reading null rows */
84  CELL *temp_buf;
85  unsigned char *compressed_buf; /* Pre/post compressed data buffer */
86  int compressed_buf_size; /* sizeof compressed_buf */
87  unsigned char *work_buf; /* work data buffer */
88  int work_buf_size; /* sizeof work_buf */
89  int null_buf_size; /* sizeof null_buf */
90  int mask_buf_size; /* sizeof mask_buf */
91  int temp_buf_size; /* sizeof temp_buf */
93 
95  struct fileinfo *fileinfo;
96 };
97 
98 extern struct G__ G__; /* allocated in gisinit */
99 
100 #define OPEN_OLD 1
101 #define OPEN_NEW_COMPRESSED 2
102 #define OPEN_NEW_UNCOMPRESSED 3
103 #define OPEN_NEW_RANDOM 4
int mask_fd
Definition: G.h:80
int want_histogram
Definition: G.h:92
int nbytes
Definition: G.h:58
int auto_mask
Definition: G.h:81
unsigned char * work_buf
Definition: G.h:87
int want_histogram
Definition: G.h:49
int null_buf_size
Definition: G.h:89
RASTER_MAP_TYPE map_type
Definition: G.h:59
char * null_buf
Definition: G.h:83
char * name
Definition: G.h:63
off_t * row_ptr
Definition: G.h:51
int io_error
Definition: G.h:65
int fileinfo_count
Definition: G.h:94
int mask_buf_size
Definition: G.h:90
unsigned char * null_work_buf
Definition: G.h:68
char * temp_name
Definition: G.h:60
int compressed_buf_size
Definition: G.h:86
unsigned char * data
Definition: G.h:57
COLUMN_MAPPING * col_map
Definition: G.h:52
struct GDAL_link * gdal
Definition: G.h:71
int work_buf_size
Definition: G.h:88
struct Range range
Definition: G.h:47
int temp_buf_size
Definition: G.h:91
struct Reclass reclass
Definition: G.h:45
struct Cell_head window
Definition: G.h:78
Definition: G.h:74
double C1
Definition: G.h:53
tuple data
struct Cell_stats statf
Definition: G.h:46
char * mapset
Definition: G.h:64
int open_mode
Definition: G.h:43
int cur_row
Definition: G.h:54
int window_set
Definition: G.h:79
char * null_temp_name
Definition: G.h:61
int cur_nbytes
Definition: G.h:56
double C2
Definition: G.h:53
int null_file_exists
Definition: G.h:62
struct fileinfo * fileinfo
Definition: G.h:95
XDR xdrstream
Definition: G.h:66
unsigned char * compressed_buf
Definition: G.h:85
int fp_nbytes
Definition: G.h:76
struct Cell_head cellhd
Definition: G.h:44
int min_null_row
Definition: G.h:69
Definition: G.h:41
int COLUMN_MAPPING
Definition: G.h:19
CELL * temp_buf
Definition: G.h:84
#define NULL_ROWS_INMEM
Definition: G.h:11
int null_cur_row
Definition: G.h:55
CELL * mask_buf
Definition: G.h:82
RASTER_MAP_TYPE fp_type
Definition: G.h:77
struct Quant quant
Definition: G.h:70
unsigned char * NULL_ROWS[NULL_ROWS_INMEM]
Definition: G.h:67
struct FPRange fp_range
Definition: G.h:48
int reclass_flag
Definition: G.h:50