Skip to content
Permalink
Browse files

raster cats to info

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5027 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek
rblazek committed Mar 15, 2006
1 parent dad6faa commit 2ef9bb3ecfd89256dbbfc631068d701c37d9a8dc
Showing with 27 additions and 2 deletions.
  1. +27 −2 src/plugins/grass/qgsgrassmodel.cpp
@@ -146,6 +146,7 @@ QString QgsGrassModelItem::info()
str += htmlTableRow("<b>Raster</b>", "<b>" + mMap + "</b>" );

struct Cell_head head;
int rasterType = -1;
QgsGrass::setLocation( mGisbase, mLocation );

if( G_get_cellhd( mMap.toLocal8Bit().data(),
@@ -164,7 +165,7 @@ QString QgsGrassModelItem::info()
str += htmlTableRow ( "East", QString::number(head.east) );
str += htmlTableRow ( "West", QString::number(head.west) );

int rasterType = G_raster_map_type( mMap.toLocal8Bit().data(),
rasterType = G_raster_map_type( mMap.toLocal8Bit().data(),
mMapset.toLocal8Bit().data() );

QString format;
@@ -188,6 +189,7 @@ QString QgsGrassModelItem::info()
str += htmlTableRow ( "Format", format );
}

// Range of values
struct FPRange range;
if ( G_read_fp_range( mMap.toLocal8Bit().data(),
mMapset.toLocal8Bit().data(), &range ) != -1 )
@@ -198,8 +200,8 @@ QString QgsGrassModelItem::info()
str += htmlTableRow ( "Minimum value", QString::number(min));
str += htmlTableRow ( "Maximum value", QString::number(max));
}


// History
struct History hist;
if ( G_read_history( mMap.toLocal8Bit().data(),
mMapset.toLocal8Bit().data(), &hist) >= 0 )
@@ -224,6 +226,29 @@ QString QgsGrassModelItem::info()
str += htmlTableRow ( "Comments", h);
}
}

// Categories
if ( rasterType == CELL_TYPE )
{
struct Categories Cats;
int ret = G_read_cats( mMap.toLocal8Bit().data(),
mMapset.toLocal8Bit().data(), &Cats);

if ( ret == 0 )
{
if ( Cats.ncats > 0 )
{
str += "<tr><td colspan=2>Categories</td></tr>";
for ( int i = 0; i < Cats.ncats; i++)
{
str += htmlTableRow (
QString::number((int)Cats.q.table[i].dLow),
QString(Cats.labels[i]));
}
}
G_free_cats(&Cats);
}
}
str += "</table>";

return str;

0 comments on commit 2ef9bb3

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