~ubuntu-branches/debian/sid/gdal/sid

« back to all changes in this revision

Viewing changes to frmts/grass/grass57dataset.cpp

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2012-05-07 15:04:42 UTC
  • mfrom: (5.5.16 experimental)
  • Revision ID: package-import@ubuntu.com-20120507150442-2eks97loeh6rq005
Tags: 1.9.0-1
* Ready for sid, starting transition.
* All symfiles updated to latest builds.
* Added dh_numpy call in debian/rules to depend on numpy ABI.
* Policy bumped to 3.9.3, no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 $
3
3
 *
4
4
 * Project:  GRASS Driver
5
5
 * Purpose:  Implement GRASS raster read/write support
56
56
 
57
57
#define GRASS_MAX_COLORS 100000  // what is the right value
58
58
 
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 $");
60
60
 
61
61
CPL_C_START
62
62
void    GDALRegister_GRASS(void);
63
63
CPL_C_END
64
64
 
 
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
 
74
#define G_copy                   memcpy
 
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
 
88
#endif
 
89
 
65
90
/************************************************************************/
66
91
/*                         Grass2CPLErrorHook()                         */
67
92
/************************************************************************/
308
333
            int nRed, nGreen, nBlue;
309
334
            GDALColorEntry    sColor;
310
335
 
 
336
#if GRASS_VERSION_MAJOR  >= 7
 
337
            if( Rast_get_c_color( &iColor, &nRed, &nGreen, &nBlue, &sGrassColors ) )
 
338
#else
311
339
            if( G_get_color( iColor, &nRed, &nGreen, &nBlue, &sGrassColors ) )
 
340
#endif
312
341
            {
313
342
                sColor.c1 = nRed;
314
343
                sColor.c2 = nGreen;
713
742
    if ( pszElement )
714
743
        G_free ( pszElement );
715
744
 
716
 
    CPLFree( pszProjection );
 
745
    G_free( pszProjection );
717
746
}
718
747
 
719
748
/************************************************************************/
921
950
/* -------------------------------------------------------------------- */
922
951
/*      Capture some information from the file that is of interest.     */
923
952
/* -------------------------------------------------------------------- */
924
 
    
 
953
 
 
954
#if GRASS_VERSION_MAJOR  >= 7
 
955
    Rast_get_cellhd( papszCells[0], papszMapsets[0], &(poDS->sCellInfo) );
 
956
#else
925
957
    if( G_get_cellhd( papszCells[0], papszMapsets[0], &(poDS->sCellInfo) ) != 0 ) {
926
 
        CPLError( CE_Warning, CPLE_AppDefined, "GRASS: Cannot open raster header");
927
 
        delete poDS;
928
 
        return NULL;
 
958
        CPLError( CE_Warning, CPLE_AppDefined, "GRASS: Cannot open raster header");
 
959
        delete poDS;
 
960
        return NULL;
929
961
    }
 
962
#endif
930
963
 
931
964
    poDS->nRasterXSize = poDS->sCellInfo.cols;
932
965
    poDS->nRasterYSize = poDS->sCellInfo.rows;