R.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. off_t *null_row_ptr; /* Null file row addresses */
  66. };
  67. struct R__ /* Structure of library globals */
  68. {
  69. RASTER_MAP_TYPE fp_type; /* type for writing floating maps */
  70. int mask_fd; /* File descriptor for automatic mask */
  71. int auto_mask; /* Flag denoting automatic masking */
  72. int want_histogram;
  73. int nbytes;
  74. int compression_type;
  75. int compress_nulls;
  76. int window_set; /* Flag: window set? */
  77. int split_window; /* Separate windows for input and output */
  78. struct Cell_head rd_window; /* Window used for input */
  79. struct Cell_head wr_window; /* Window used for output */
  80. int fileinfo_count;
  81. struct fileinfo *fileinfo;
  82. };
  83. extern struct R__ R__; /* allocated in init */
  84. #define OPEN_OLD 1
  85. #define OPEN_NEW_COMPRESSED 2
  86. #define OPEN_NEW_UNCOMPRESSED 3