Skip to content
Permalink
Browse files

get null outside map

git-svn-id: http://svn.osgeo.org/qgis/trunk@12888 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek
rblazek committed Feb 5, 2010
1 parent e363dbf commit 1e66aa7346baff85d56bae40d097d619cd6a3275
Showing with 25 additions and 17 deletions.
  1. +25 −17 src/providers/grass/qgis.g.info.c
@@ -101,28 +101,36 @@ int main(int argc, char **argv)
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 )
{

0 comments on commit 1e66aa7

Please sign in to comment.
You can’t perform that action at this time.