Skip to content

Commit

Permalink
Legend items for singleband gray renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Apr 14, 2012
1 parent b15e955 commit 697a54c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core/raster/qgssinglebandgrayrenderer.cpp
Expand Up @@ -190,3 +190,12 @@ void QgsSingleBandGrayRenderer::writeXML( QDomDocument& doc, QDomElement& parent
}
parentElem.appendChild( rasterRendererElem );
}

void QgsSingleBandGrayRenderer::legendSymbologyItems( QList< QPair< QString, QColor > >& symbolItems ) const
{
if ( mContrastEnhancement && mContrastEnhancement->contrastEnhancementAlgorithm() != QgsContrastEnhancement::NoEnhancement )
{
symbolItems.push_back( qMakePair( QString::number( mContrastEnhancement->minimumValue() ), QColor( 0, 0, 0 ) ) );
symbolItems.push_back( qMakePair( QString::number( mContrastEnhancement->maximumValue() ), QColor( 255, 255, 255 ) ) );
}
}
2 changes: 2 additions & 0 deletions src/core/raster/qgssinglebandgrayrenderer.h
Expand Up @@ -41,6 +41,8 @@ class QgsSingleBandGrayRenderer: public QgsRasterRenderer

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

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

private:
int mGrayBand;
QgsContrastEnhancement* mContrastEnhancement;
Expand Down

0 comments on commit 697a54c

Please sign in to comment.