[QGIS Commit] r12888 - trunk/qgis/src/providers/grass
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Fri Feb 5 14:14:36 EST 2010
Author: rblazek
Date: 2010-02-05 14:14:35 -0500 (Fri, 05 Feb 2010)
New Revision: 12888
Modified:
trunk/qgis/src/providers/grass/qgis.g.info.c
Log:
get null outside map
Modified: trunk/qgis/src/providers/grass/qgis.g.info.c
===================================================================
--- trunk/qgis/src/providers/grass/qgis.g.info.c 2010-02-05 15:23:34 UTC (rev 12887)
+++ trunk/qgis/src/providers/grass/qgis.g.info.c 2010-02-05 19:14:35 UTC (rev 12888)
@@ -101,28 +101,36 @@
if (col == window.cols) col--;
if (row == window.rows) row--;
- rast_type = G_get_raster_map_type(fd);
- cell = G_allocate_c_raster_buf();
- dcell = G_allocate_d_raster_buf();
-
- if (rast_type == CELL_TYPE)
+ if ( col < 0 || col > window.cols || row < 0 || row > window.rows )
{
- if (G_get_c_raster_row(fd, cell, row) < 0)
- {
- G_fatal_error(("Unable to read raster map <%s> row %d"),
- rast_opt->answer, row);
- }
- fprintf (stdout, "value:%d\n", cell[col] );
- }
+ fprintf (stdout, "value:null\n");
+ }
else
- {
- if (G_get_d_raster_row(fd, dcell, row) < 0)
+ {
+ rast_type = G_get_raster_map_type(fd);
+ cell = G_allocate_c_raster_buf();
+ dcell = G_allocate_d_raster_buf();
+
+ if (rast_type == CELL_TYPE)
{
- G_fatal_error(("Unable to read raster map <%s> row %d"),
- rast_opt->answer, row);
+ if (G_get_c_raster_row(fd, cell, row) < 0)
+ {
+ G_fatal_error(("Unable to read raster map <%s> row %d"),
+ rast_opt->answer, row);
+ }
+ fprintf (stdout, "value:%d\n", cell[col] );
+ }
+ else
+ {
+ if (G_get_d_raster_row(fd, dcell, row) < 0)
+ {
+ G_fatal_error(("Unable to read raster map <%s> row %d"),
+ rast_opt->answer, row);
+ }
+ fprintf (stdout, "value:%f\n", dcell[col] );
}
- fprintf (stdout, "value:%f\n", dcell[col] );
}
+ G_close_cell( fd );
}
else if ( vect_opt->answer )
{
More information about the QGIS-commit
mailing list