Skip to content

Commit

Permalink
Raster legend for paletted renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Apr 14, 2012
1 parent c236182 commit b15e955
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core/raster/qgspalettedrasterrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,11 @@ void QgsPalettedRasterRenderer::writeXML( QDomDocument& doc, QDomElement& parent

parentElem.appendChild( rasterRendererElem );
}

void QgsPalettedRasterRenderer::legendSymbologyItems( QList< QPair< QString, QColor > >& symbolItems ) const
{
for ( int i = 0; i < mNColors; ++i )
{
symbolItems.push_back( qMakePair( QString::number( i ), mColors[i] ) );
}
}
2 changes: 2 additions & 0 deletions src/core/raster/qgspalettedrasterrenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class QgsPalettedRasterRenderer: public QgsRasterRenderer

void writeXML( QDomDocument& doc, QDomElement& parentElem ) const;

void legendSymbologyItems( QList< QPair< QString, QColor > >& symbolItems ) const;

private:
int mBandNumber;
/**Color array*/
Expand Down

0 comments on commit b15e955

Please sign in to comment.