QgsColorRampShader Class Reference
[Core]

#include <qgscolorrampshader.h>

Inheritance diagram for QgsColorRampShader:

Inheritance graph
[legend]
Collaboration diagram for QgsColorRampShader:

Collaboration graph
[legend]
List of all members.

Detailed Description

A ramp shader will color a raster pixel based on a list of values ranges in a ramp.

Definition at line 32 of file qgscolorrampshader.h.

Public Types

enum  ColorRamp_TYPE { INTERPOLATED, DISCRETE, EXACT }

Public Member Functions

 QgsColorRampShader (double theMinimumValue=0.0, double theMaximumValue=255.0)
QList< QgsColorRampShader::ColorRampItemcolorRampItemList () const
 Get the custom colormap.
QgsColorRampShader::ColorRamp_TYPE colorRampType ()
 Get the color ramp type.
QString colorRampTypeAsQString ()
 Get the color ramp type as a string.
int maximumColorCacheSize ()
 Get the maximum size the color cache can be.
void setColorRampItemList (const QList< QgsColorRampShader::ColorRampItem > &theList)
 Set custom colormap.
void setColorRampType (QgsColorRampShader::ColorRamp_TYPE theColorRampType)
 Set the color ramp type.
void setColorRampType (QString)
 Set the color ramp type.
void setMaximumColorCacheSize (int theSize)
 Set the maximum size the color cache can be.
bool shade (double, int *, int *, int *)
 Generates and new RGB value based on one input value.
bool shade (double, double, double, int *, int *, int *)
 Generates and new RGB value based on original RGB value.

Private Member Functions

bool discreteColor (double, int *, int *, int *)
 Gets the color for a pixel value from the classification vector mValueClassification.
bool exactColor (double, int *, int *, int *)
 Gets the color for a pixel value from the classification vector mValueClassification.
bool interpolatedColor (double, int *, int *, int *)
 Gets the color for a pixel value from the classification vector mValueClassification.

Private Attributes

int mCurrentColorRampItemIndex
 Current index from which to start searching the color table.
QList< QgsColorRampShader::ColorRampItemmColorRampItemList
 This vector holds the information for classification based on values.
QgsColorRampShader::ColorRamp_TYPE mColorRampType
 The color ramp type.
QMap< double, QColor > mColorCache
 Cache of values that have already been looked up.
int mMaximumColorCacheSize
 Maximum size of the color cache.

Classes

struct  ColorRampItem


Member Enumeration Documentation

enum QgsColorRampShader::ColorRamp_TYPE

Enumerator:
INTERPOLATED 
DISCRETE 
EXACT 

Definition at line 49 of file qgscolorrampshader.h.


Constructor & Destructor Documentation

QgsColorRampShader::QgsColorRampShader ( double  theMinimumValue = 0.0,
double  theMaximumValue = 255.0 
)

Definition at line 25 of file qgscolorrampshader.cpp.

References mCurrentColorRampItemIndex, mMaximumColorCacheSize, and QgsDebugMsg.


Member Function Documentation

QList<QgsColorRampShader::ColorRampItem> QgsColorRampShader::colorRampItemList (  )  const [inline]

Get the custom colormap.

Definition at line 57 of file qgscolorrampshader.h.

Referenced by QgsRasterLayer::paletteAsPixmap().

QgsColorRampShader::ColorRamp_TYPE QgsColorRampShader::colorRampType (  )  [inline]

Get the color ramp type.

Definition at line 60 of file qgscolorrampshader.h.

QString QgsColorRampShader::colorRampTypeAsQString (  ) 

Get the color ramp type as a string.

Definition at line 32 of file qgscolorrampshader.cpp.

References DISCRETE, EXACT, INTERPOLATED, and mColorRampType.

int QgsColorRampShader::maximumColorCacheSize (  )  [inline]

Get the maximum size the color cache can be.

Definition at line 66 of file qgscolorrampshader.h.

void QgsColorRampShader::setColorRampItemList ( const QList< QgsColorRampShader::ColorRampItem > &  theList  )  [inline]

Set custom colormap.

Definition at line 69 of file qgscolorrampshader.h.

Referenced by QgsRasterLayer::paletteAsPixmap(), and QgsRasterLayer::readFile().

void QgsColorRampShader::setColorRampType ( QgsColorRampShader::ColorRamp_TYPE  theColorRampType  ) 

Set the color ramp type.

Definition at line 201 of file qgscolorrampshader.cpp.

References mColorCache, and mColorRampType.

Referenced by QgsRasterLayer::paletteAsPixmap(), and QgsRasterLayer::readFile().

void QgsColorRampShader::setColorRampType ( QString   ) 

Set the color ramp type.

Definition at line 208 of file qgscolorrampshader.cpp.

References DISCRETE, EXACT, INTERPOLATED, mColorCache, and mColorRampType.

void QgsColorRampShader::setMaximumColorCacheSize ( int  theSize  )  [inline]

Set the maximum size the color cache can be.

Definition at line 78 of file qgscolorrampshader.h.

bool QgsColorRampShader::shade ( double  ,
int *  ,
int *  ,
int *   
) [virtual]

Generates and new RGB value based on one input value.

Reimplemented from QgsRasterShaderFunction.

Definition at line 226 of file qgscolorrampshader.cpp.

References discreteColor(), EXACT, exactColor(), INTERPOLATED, interpolatedColor(), mColorCache, mColorRampItemList, mColorRampType, and mCurrentColorRampItemIndex.

Referenced by QgsRasterLayer::paletteAsPixmap().

bool QgsColorRampShader::shade ( double  ,
double  ,
double  ,
int *  ,
int *  ,
int *   
) [virtual]

Generates and new RGB value based on original RGB value.

Reimplemented from QgsRasterShaderFunction.

Definition at line 263 of file qgscolorrampshader.cpp.

bool QgsColorRampShader::discreteColor ( double  ,
int *  ,
int *  ,
int *   
) [private]

Gets the color for a pixel value from the classification vector mValueClassification.

Assigns the color of the lower class for every pixel between two class breaks.

Definition at line 49 of file qgscolorrampshader.cpp.

References QgsColorRampShader::ColorRampItem::color, mColorCache, mColorRampItemList, mCurrentColorRampItemIndex, mMaximumColorCacheSize, and QgsColorRampShader::ColorRampItem::value.

Referenced by shade().

bool QgsColorRampShader::exactColor ( double  ,
int *  ,
int *  ,
int *   
) [private]

Gets the color for a pixel value from the classification vector mValueClassification.

Assigns the color of the exact matching value in the color ramp item list

Definition at line 89 of file qgscolorrampshader.cpp.

References QgsColorRampShader::ColorRampItem::color, mColorCache, mColorRampItemList, mCurrentColorRampItemIndex, mMaximumColorCacheSize, and QgsColorRampShader::ColorRampItem::value.

Referenced by shade().

bool QgsColorRampShader::interpolatedColor ( double  ,
int *  ,
int *  ,
int *   
) [private]

Gets the color for a pixel value from the classification vector mValueClassification.

Interpolates the color between two class breaks linearly.

Definition at line 134 of file qgscolorrampshader.cpp.

References QgsColorRampShader::ColorRampItem::color, mColorCache, mColorRampItemList, mCurrentColorRampItemIndex, mMaximumColorCacheSize, and QgsColorRampShader::ColorRampItem::value.

Referenced by shade().


Member Data Documentation

int QgsColorRampShader::mCurrentColorRampItemIndex [private]

Current index from which to start searching the color table.

Definition at line 88 of file qgscolorrampshader.h.

Referenced by discreteColor(), exactColor(), interpolatedColor(), QgsColorRampShader(), and shade().

QList<QgsColorRampShader::ColorRampItem> QgsColorRampShader::mColorRampItemList [private]

This vector holds the information for classification based on values.

Each item holds a value, a label and a color. The member mDiscreteClassification holds if one color is applied for all values between two class breaks (true) or if the item values are (linearly) interpolated for values between the item values (false)

Definition at line 92 of file qgscolorrampshader.h.

Referenced by discreteColor(), exactColor(), interpolatedColor(), and shade().

QgsColorRampShader::ColorRamp_TYPE QgsColorRampShader::mColorRampType [private]

The color ramp type.

Definition at line 95 of file qgscolorrampshader.h.

Referenced by colorRampTypeAsQString(), setColorRampType(), and shade().

QMap<double, QColor> QgsColorRampShader::mColorCache [private]

Cache of values that have already been looked up.

Definition at line 98 of file qgscolorrampshader.h.

Referenced by discreteColor(), exactColor(), interpolatedColor(), setColorRampType(), and shade().

int QgsColorRampShader::mMaximumColorCacheSize [private]

Maximum size of the color cache.

The color cache could eat a ton of memory if you have 32-bit data

Definition at line 101 of file qgscolorrampshader.h.

Referenced by discreteColor(), exactColor(), interpolatedColor(), and QgsColorRampShader().


The documentation for this class was generated from the following files:
Generated on Tue Jan 6 16:51:19 2009 for Quantum GIS API Documentation by  doxygen 1.5.1