1
1
/******************************************************************************
2
* $Id: grass57dataset.cpp 18537 2010-01-12 15:05:51Z rblazek $
2
* $Id: grass57dataset.cpp 20157 2010-07-28 19:32:04Z rouault $
4
4
* Project: GRASS Driver
5
5
* Purpose: Implement GRASS raster read/write support
57
57
#define GRASS_MAX_COLORS 100000 // what is the right value
59
CPL_CVSID("$Id: grass57dataset.cpp 18537 2010-01-12 15:05:51Z rblazek $");
59
CPL_CVSID("$Id: grass57dataset.cpp 20157 2010-07-28 19:32:04Z rouault $");
62
62
void GDALRegister_GRASS(void);
65
#if GRASS_VERSION_MAJOR >= 7
66
#define G_get_cellhd Rast_get_cellhd
67
#define G_raster_map_type Rast_map_type
68
#define G_read_fp_range Rast_read_fp_range
69
#define G_get_fp_range_min_max Rast_get_fp_range_min_max
70
#define G_set_c_null_value Rast_set_c_null_value
71
#define G_set_f_null_value Rast_set_f_null_value
72
#define G_set_d_null_value Rast_set_d_null_value
73
#define G_open_cell_old Rast_open_old
75
#define G_read_colors Rast_read_colors
76
#define G_get_color_range Rast_get_c_color_range
77
#define G_colors_count Rast_colors_count
78
#define G_get_f_color_rule Rast_get_fp_color_rule
79
#define G_free_colors Rast_free_colors
80
#define G_close_cell Rast_close
81
#define G_allocate_c_raster_buf Rast_allocate_c_buf
82
#define G_get_c_raster_row Rast_get_c_row
83
#define G_is_c_null_value Rast_is_c_null_value
84
#define G_get_f_raster_row Rast_get_f_row
85
#define G_get_d_raster_row Rast_get_d_row
86
#define G_allocate_f_raster_buf Rast_allocate_f_buf
87
#define G_allocate_d_raster_buf Rast_allocate_d_buf
65
90
/************************************************************************/
66
91
/* Grass2CPLErrorHook() */
67
92
/************************************************************************/
308
333
int nRed, nGreen, nBlue;
309
334
GDALColorEntry sColor;
336
#if GRASS_VERSION_MAJOR >= 7
337
if( Rast_get_c_color( &iColor, &nRed, &nGreen, &nBlue, &sGrassColors ) )
311
339
if( G_get_color( iColor, &nRed, &nGreen, &nBlue, &sGrassColors ) )
313
342
sColor.c1 = nRed;
314
343
sColor.c2 = nGreen;
921
950
/* -------------------------------------------------------------------- */
922
951
/* Capture some information from the file that is of interest. */
923
952
/* -------------------------------------------------------------------- */
954
#if GRASS_VERSION_MAJOR >= 7
955
Rast_get_cellhd( papszCells[0], papszMapsets[0], &(poDS->sCellInfo) );
925
957
if( G_get_cellhd( papszCells[0], papszMapsets[0], &(poDS->sCellInfo) ) != 0 ) {
926
CPLError( CE_Warning, CPLE_AppDefined, "GRASS: Cannot open raster header");
958
CPLError( CE_Warning, CPLE_AppDefined, "GRASS: Cannot open raster header");
931
964
poDS->nRasterXSize = poDS->sCellInfo.cols;
932
965
poDS->nRasterYSize = poDS->sCellInfo.rows;