Skip to content

Commit

Permalink
get null outside map
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@12888 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Feb 5, 2010
1 parent e363dbf commit 1e66aa7
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions src/providers/grass/qgis.g.info.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down

0 comments on commit 1e66aa7

Please sign in to comment.