[QGIS Commit] r12924 - trunk/qgis/src/providers/grass
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Thu Feb 11 04:53:42 EST 2010
Author: rblazek
Date: 2010-02-11 04:53:41 -0500 (Thu, 11 Feb 2010)
New Revision: 12924
Modified:
trunk/qgis/src/providers/grass/qgis.g.info.c
Log:
handle better null values
Modified: trunk/qgis/src/providers/grass/qgis.g.info.c
===================================================================
--- trunk/qgis/src/providers/grass/qgis.g.info.c 2010-02-11 07:41:35 UTC (rev 12923)
+++ trunk/qgis/src/providers/grass/qgis.g.info.c 2010-02-11 09:53:41 UTC (rev 12924)
@@ -108,6 +108,8 @@
rast_type = G_get_raster_map_type( fd );
cell = G_allocate_c_raster_buf();
dcell = G_allocate_d_raster_buf();
+ void *ptr;
+ double val;
if ( rast_type == CELL_TYPE )
{
@@ -116,7 +118,8 @@
G_fatal_error(( "Unable to read raster map <%s> row %d" ),
rast_opt->answer, row );
}
- fprintf( stdout, "value:%d\n", cell[col] );
+ val = cell[col];
+ ptr = &(cell[col]);
}
else
{
@@ -125,8 +128,17 @@
G_fatal_error(( "Unable to read raster map <%s> row %d" ),
rast_opt->answer, row );
}
- fprintf( stdout, "value:%f\n", dcell[col] );
+ val = dcell[col];
+ ptr = &(dcell[col]);
}
+ if ( G_is_null_value( ptr, rast_type ) )
+ {
+ fprintf( stdout, "value:null\n" );
+ }
+ else
+ {
+ fprintf( stdout, "value:%f\n", val );
+ }
}
G_close_cell( fd );
}
More information about the QGIS-commit
mailing list