[QGIS-trac] Re: [Quantum GIS] #47: raster legend in map composer

Quantum GIS qgis at qgis.org
Fri Sep 5 17:41:52 EDT 2008


#47: raster legend in map composer
-----------------------------------------------------+----------------------
        Reporter:  cavallini at faunalia.it             |         Owner:  timlinux              
            Type:  enhancement                       |        Status:  new                   
        Priority:  major: does not work as expected  |     Milestone:  Version 1.0.0         
       Component:  Rasters                           |       Version:  HEAD                  
      Resolution:                                    |      Keywords:  printing raster legend
Platform_version:                                    |      Platform:  All                   
        Must_fix:  No                                |   Status_info:  0                     
-----------------------------------------------------+----------------------
Comment (by ersts):

 This actually is already possible

 For Paletted, Pseudo and Freakout it would looks something like this, get
 the current shader (only one per raster layer)
 *myRasterShader = RasterLayer->getRasterShader()

 loop through all values you want to show in the legend
 for(int runner = RasterLayer->getMinimumValue(band a); runner <=
 RasterLayer->getMaximumValue(band a); runner++)
 {
    if(myRasterShader->generateShadedValue((double)runner, &red, &green,
 &blue)
    {
      //set the color of your object
      color_my_legend_item(new QColor(red, green, blue))
    }
 }

-- 
Ticket URL: <http://trac.osgeo.org/qgis/ticket/47#comment:9>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats


More information about the QGIS-trac mailing list