Skip to content

Commit

Permalink
Symbol items for pseudo color shader
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Jun 14, 2011
1 parent ed6df31 commit 992be14
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/raster/qgspseudocolorshader.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ class CORE_EXPORT QgsPseudoColorShader : public QgsRasterShaderFunction
/** \brief Return the minimum value */
void setMinimumValue( double );

double classBreakMin1() const { return mClassBreakMin1; }
double classBreakMax1() const { return mClassBreakMax1; }
double classBreakMin2() const { return mClassBreakMin2; }
double classBreakMax2() const { return mClassBreakMax2; }
double classBreakMin3() const { return mClassBreakMin3; }

private:
void setClassBreaks();

Expand Down
13 changes: 13 additions & 0 deletions src/core/raster/qgsrasterlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,19 @@ QList< QPair< QString, QColor > > QgsRasterLayer::legendSymbologyItems() const
}
break;
}
case PseudoColorShader:
{
//class breaks have fixed color for the pseudo color shader
const QgsPseudoColorShader* pcShader = dynamic_cast<QgsPseudoColorShader*>( mRasterShader->rasterShaderFunction() );
if( pcShader )
{
symbolList.push_back( qMakePair( QString::number( pcShader->classBreakMin1() ), QColor( 0, 0, 255 ) ) );
symbolList.push_back( qMakePair( QString::number( pcShader->classBreakMax1() ), QColor( 0, 255, 255 ) ) );
symbolList.push_back( qMakePair( QString::number( pcShader->classBreakMax2() ), QColor(255, 255, 0 ) ) );
symbolList.push_back( qMakePair( QString::number( pcShader->classBreakMin2() ), QColor( 255, 0, 0 ) ) );
}
break;
}
default:
break;
}
Expand Down
2 changes: 2 additions & 0 deletions src/core/raster/qgsrastershaderfunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class CORE_EXPORT QgsRasterShaderFunction
/** \brief generates and new RGB value based on original RGB value */
virtual bool shade( double, double, double, int*, int*, int* );

double minimumMaximumRange() const { return mMinimumMaximumRange; }

protected:
/** \brief User defineable maximum value for the shading function */
double mMaximumValue;
Expand Down

0 comments on commit 992be14

Please sign in to comment.