R.h 3.1 KB

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