QgsRasterLayer Class Reference
[QGIS core library]

This class provides qgis with the ability to render raster datasets onto the mapcanvas. More...

#include <qgsrasterlayer.h>

Inheritance diagram for QgsRasterLayer:

Inheritance graph
[legend]
Collaboration diagram for QgsRasterLayer:

Collaboration graph
[legend]

List of all members.

Public Types

enum  ColorShadingAlgorithm {
  UndefinedShader, PseudoColorShader, FreakOutShader, ColorRampShader,
  UserDefinedShader
}
 This enumerator describes the types of shading that can be used. More...
enum  DrawingStyle {
  UndefinedDrawingStyle, SingleBandGray, SingleBandPseudoColor, PalettedColor,
  PalettedSingleBandGray, PalettedSingleBandPseudoColor, PalettedMultiBandColor, MultiBandSingleGandGray,
  MultiBandSingleBandGray = MultiBandSingleGandGray, MultiBandSingleBandPseudoColor, MultiBandColor
}
 This enumerator describes the different kinds of drawing we can do. More...
enum  LayerType { GrayOrUndefined, Palette, Multiband }
 This enumerator describes the type of raster layer. More...
typedef QList
< QgsContrastEnhancement
ContrastEnhancementList
 A list containing on ContrastEnhancement object per raster band in this raster layer.
typedef QList< QgsRasterPyramidRasterPyramidList
 A list containing one RasterPyramid struct per raster band in this raster layer.
typedef QList< QgsRasterBandStatsRasterStatsList
 A list containing one RasterBandStats struct per raster band in this raster layer.

Public Slots

QString buildPyramids (const RasterPyramidList &, const QString &theResamplingMethod="NEAREST", bool theTryInternalFlag=false)
 Create GDAL pyramid overviews.
void populateHistogram (int theBandNoInt, int theBinCountInt=256, bool theIgnoreOutOfRangeFlag=true, bool theThoroughBandScanFlag=false)
 Populate the histogram vector for a given band.
void showStatusMessage (const QString &theMessage)
void updateProgress (int, int)
 Propagate progress updates from GDAL up to the parent app.

Signals

void progressUpdate (int theValue)
 Signal for notifying listeners of long running processes.

Public Member Functions

 QgsRasterLayer (const QString &path=QString::null, const QString &baseName=QString::null, bool loadDefaultStyleFlag=true)
 This is the constructor for the RasterLayer class.
 QgsRasterLayer (int dummy, const QString &baseName=QString(), const QString &path=QString(), const QString &providerLib=QString(), const QStringList &layers=QStringList(), const QStringList &styles=QStringList(), const QString &format=QString(), const QString &crs=QString())
 [ data provider interface ] Constructor in provider mode
 ~QgsRasterLayer ()
 The destructor.
QString blueBandName () const
 Accessor for blue band name mapping.
QgsRasterLayer::ColorShadingAlgorithm colorShadingAlgorithm () const
 Accessor for color shader algorithm.
QgsContrastEnhancement::ContrastEnhancementAlgorithm contrastEnhancementAlgorithm ()
 Accessor for contrast enhancement algorithm.
QString contrastEnhancementAlgorithmAsString () const
 Returns contrast enhancement algorithm as a string.
DrawingStyle drawingStyle ()
 Accessor for drawing style.
QString grayBandName () const
 Accessor for gray band name mapping.
QString greenBandName () const
 Accessor for green band name mapping.
bool hasPyramids ()
 Accessor for mHasPyramids (READ ONLY).
bool hasUserDefinedGrayMinimumMaximum () const
 Accessor for mUserDefinedGrayMinimumMaximum.
bool hasUserDefinedRGBMinimumMaximum () const
 Accessor for mUserDefinedRGBMinimumMaximum.
int height ()
 Accessor that returns the height of the (unclipped) raster.
bool invertHistogram () const
 Accessor to find out whether the histogram should be inverted.
bool isNoDataValueValid () const
 Is the NoDataValue Valid.
bool isGrayMinimumMaximumEstimated () const
 Accessor for mGrayMinimumMaximumEstimated.
bool isRGBMinimumMaximumEstimated () const
 Accessor for mRGBMinimumMaximumEstimated.
double noDataValue (bool *isValid=0)
 Accessor that returns the NO_DATA entry for this raster.
QgsRasterTransparencyrasterTransparency ()
 Returns a pointer to the transparency object.
QgsRasterShaderrasterShader ()
 Accessor for raster shader.
LayerType rasterType ()
 Accessor for raster layer type (which is a read only property).
QString redBandName () const
 Accessor for red band name (allows alternate mappings e.g.
void setDataProvider (const QString &provider, const QStringList &layers, const QStringList &styles, const QString &format, const QString &crs)
 [ data provider interface ] Set the data provider
void setDrawingStyle (const DrawingStyle &theDrawingStyle)
 Mutator for drawing style.
void setGrayMinimumMaximumEstimated (bool theBool)
 Mutator for mGrayMinimumMaximumEstimated.
void setInvertHistogram (bool theFlag)
 Mutator to alter the state of the invert histogram flag.
void setRGBMinimumMaximumEstimated (bool theBool)
 Mutator for mRGBMinimumMaximumEstimated.
void setStandardDeviations (double theStandardDeviations)
 Mutator to alter the number of standard deviations that should be plotted.
void setUserDefinedGrayMinimumMaximum (bool theBool)
 Mutator for mUserDefinedGrayMinimumMaximum.
void setUserDefinedRGBMinimumMaximum (bool theBool)
 Mutator for mUserDefinedRGBMinimumMaximum.
double standardDeviations () const
 Accessor to find out how many standard deviations are being plotted.
QString transparentBandName () const
 Accessor for transparent band name mapping.
bool usesProvider ()
 [ data provider interface ] Does this layer use a provider for setting/retrieving data?
int width ()
 Accessor that returns the width of the (unclipped) raster.
unsigned int bandCount ()
 Get the number of bands in this layer.
const QString bandName (int theBandNoInt)
 Get the name of a band given its number.
int bandNumber (const QString &theBandName)
 Get the number of a band given its name.
const QgsRasterBandStats bandStatistics (int)
 Get RasterBandStats for a band given its number (read only).
const QgsRasterBandStats bandStatistics (const QString &)
 Get RasterBandStats for a band given its name (read only).
RasterPyramidList buildPyramidList ()
 Accessor for ths raster layers pyramid list.
QString colorShadingAlgorithmAsString () const
 Accessor for color shader algorithm.
void computeMinimumMaximumEstimates (int theBand, double *theMinMax)
 Wrapper for GDALComputeRasterMinMax with the estimate option.
void computeMinimumMaximumEstimates (QString theBand, double *theMinMax)
 Wrapper for GDALComputeRasterMinMax with the estimate option.
void computeMinimumMaximumEstimates (int theBand, double &theMin, double &theMax)
 Wrapper for GDALComputeRasterMinMax with the estimate option.
void computeMinimumMaximumFromLastExtent (int theBand, double *theMinMax)
 Compute the actual minimum maximum pixel values based on the current (last) display extent.
void computeMinimumMaximumFromLastExtent (QString theBand, double *theMinMax)
 Compute the actual minimum maximum pixel values based on the current (last) display extent.
void computeMinimumMaximumFromLastExtent (int theBand, double &theMin, double &theMax)
 Compute the actual minimum maximum pixel values based on the current (last) display extent.
QgsContrastEnhancementcontrastEnhancement (unsigned int theBand)
 Get a pointer to the contrast enhancement for the selected band.
bool copySymbologySettings (const QgsMapLayer &theOther)
 Copies the symbology settings from another layer.
QList
< QgsColorRampShader::ColorRampItem > * 
colorTable (int theBandNoInt)
 Get a pointer to the color table.
QgsRasterDataProviderdataProvider ()
 Returns the data provider.
const QgsRasterDataProviderdataProvider () const
 Returns the data provider in a const-correct manner.
virtual void reload ()
 Synchronises with changes in the datasource.
bool draw (QgsRenderContext &rendererContext)
 This is called when the view on the raster layer needs to be redrawn.
void draw (QPainter *theQPainter, QgsRasterViewPort *myRasterViewPort, const QgsMapToPixel *theQgsMapToPixel=0)
 This is an overloaded version of the draw() function that is called by both draw() and thumbnailAsPixmap.
QString drawingStyleAsString () const
 Returns a string representation of drawing style.
bool hasCompatibleSymbology (const QgsMapLayer &theOther) const
 Checks if symbology is the same as another layers.
bool hasStatistics (int theBandNoInt)
 Check whether a given band number has stats associated with it.
bool identify (const QgsPoint &point, QMap< QString, QString > &results)
 Identify raster value(s) found on the point position.
QString identifyAsText (const QgsPoint &point)
 Identify arbitrary details from the WMS server found on the point position.
QString identifyAsHtml (const QgsPoint &point)
 Identify arbitrary details from the WMS server found on the point position.
bool isEditable () const
 Currently returns always false.
QString lastError ()
 [ data provider interface ] If an operation returns 0 (e.g.
QString lastErrorTitle ()
 [ data provider interface ] If an operation returns 0 (e.g.
QPixmap legendAsPixmap ()
 Get a legend image for this layer.
QPixmap legendAsPixmap (bool)
 Overloaded version of above function that can print layer name onto legend.
QPixmap legendAsPixmap (int theLabelCount)
 Use this method when you want an annotated legend suitable for print output etc.
double maximumValue (unsigned int theBand)
 Accessor for maximum value user for contrast enhancement.
double maximumValue (QString theBand)
 Accessor for maximum value user for contrast enhancement.
QString metadata ()
 Obtain GDAL Metadata for this layer.
double minimumValue (unsigned int theBand)
 Accessor for minimum value user for contrast enhancement.
double minimumValue (QString theBand)
 Accessor for minimum value user for contrast enhancement.
QPixmap paletteAsPixmap (int theBand=1)
 Get an 100x100 pixmap of the color palette.
QString providerKey ()
 [ data provider interface ] Which provider is being used for this Raster Layer?
double rasterUnitsPerPixel ()
 Returns the number of raster units per each raster pixel.
bool readColorTable (int theBandNumber, QList< QgsColorRampShader::ColorRampItem > *theList)
 Read color table from GDAL raster band.
void resetNoDataValue ()
 Simple reset function that set the noDataValue back to the value stored in the first raster band.
void setBlueBandName (const QString &theBandName)
 Mutator for blue band name mapping.
void setColorShadingAlgorithm (QgsRasterLayer::ColorShadingAlgorithm theShaderAlgorithm)
 Mutator for color shader algorithm.
void setColorShadingAlgorithm (QString theShaderAlgorithm)
 Mutator for color shader algorithm.
void setContrastEnhancementAlgorithm (QgsContrastEnhancement::ContrastEnhancementAlgorithm theAlgorithm, bool theGenerateLookupTableFlag=true)
 Mutator for contrast enhancement algorithm.
void setContrastEnhancementAlgorithm (QString theAlgorithm, bool theGenerateLookupTableFlag=true)
 Mutator for contrast enhancement algorithm.
void setContrastEnhancementFunction (QgsContrastEnhancementFunction *theFunction)
 Mutator for contrast enhancement function.
void setDrawingStyle (const QString &theDrawingStyleQString)
 Overloaded version of the above function for convenience when restoring from xml.
void setGrayBandName (const QString &theBandName)
 Mutator for gray band name mapping.
void setGreenBandName (const QString &theBandName)
 Mutator for green band name mapping.
void setMaximumValue (unsigned int theBand, double theValue, bool theGenerateLookupTableFlag=true)
 Mutator for setting the maximum value for contrast enhancement.
void setMaximumValue (QString theBand, double theValue, bool theGenerateLookupTableFlag=true)
 Mutator for setting the maximum value for contrast enhancement.
void setMinimumMaximumUsingLastExtent ()
 Sets the minimum and maximum values for the band(s) currently being displayed using the only pixel values from the last/current extent.
void setMinimumValue (unsigned int theBand, double theValue, bool theGenerateLookupTableFlag=true)
 Mutator for setting the minimum value for contrast enhancement.
void setMinimumValue (QString theBand, double theValue, bool theGenerateLookupTableFlag=true)
 Mutator for setting the minimum value for contrast enhancement.
void setNoDataValue (double theNoData)
 Mutator that allows the NO_DATA entry for this raster to be overridden.
void setRasterShaderFunction (QgsRasterShaderFunction *theFunction)
 Set the raster shader function to a user defined function.
void setRedBandName (const QString &theBandName)
 Mutator for red band name (allows alternate mappings e.g.
void setTransparentBandName (const QString &theBandName)
 Mutator for transparent band name mapping.
void showProgress (int theValue)
 [ data provider interface ] A wrapper function to emit a progress update signal
QStringList subLayers () const
 Returns the sublayers of this layer - Useful for providers that manage their own layers, such as WMS.
void thumbnailAsPixmap (QPixmap *theQPixmap)
 Draws a thumbnail of the rasterlayer into the supplied pixmap pointer.
void thumbnailAsImage (QImage *thepImage)
 Draws a thumbnail of the rasterlayer into the supplied QImage pointer.
void triggerRepaint ()
 Emit a signal asking for a repaint.
virtual void setLayerOrder (const QStringList &layers)
 Reorders the *previously selected* sublayers of this layer from bottom to top.
virtual void setSubLayerVisibility (const QString &name, bool vis)
 Set the visibility of the given sublayer name.

Static Public Member Functions

static void buildSupportedRasterFileFilter (QString &fileFilters)
 Builds the list of file filter strings to later be used by QgisApp::addRasterLayer().
static bool isValidRasterFileName (const QString &theFileNameQString, QString &retError)
 This helper checks to see whether the file name appears to be a valid raster file name.
static bool isValidRasterFileName (const QString &theFileNameQString)
static QStringList subLayers (GDALDatasetH dataset)
static QDateTime lastModified (const QString &name)
 Return time stamp for given file name.
static void registerGdalDrivers ()
 ensures that GDAL drivers are registered, but only once

Protected Member Functions

bool readSymbology (const QDomNode &node, QString &errorMessage)
 Read the symbology for the current layer from the Dom node supplied.
bool readXml (QDomNode &layer_node)
 Reads layer specific state from project file Dom node.
bool writeSymbology (QDomNode &, QDomDocument &doc, QString &errorMessage) const
 Write the symbology for the layer into the docment provided.
bool writeXml (QDomNode &layer_node, QDomDocument &doc)
 Write layer specific state to project file Dom node.

Private Member Functions

void drawMultiBandColor (QPainter *theQPainter, QgsRasterViewPort *theRasterViewPort, const QgsMapToPixel *theQgsMapToPixel)
 Drawing routine for multiband image.
void drawMultiBandSingleBandGray (QPainter *theQPainter, QgsRasterViewPort *theRasterViewPort, const QgsMapToPixel *theQgsMapToPixel, int theBandNoInt)
 Drawing routine for multiband image, rendered as a single band image in grayscale.
void drawMultiBandSingleBandPseudoColor (QPainter *theQPainter, QgsRasterViewPort *theRasterViewPort, const QgsMapToPixel *theQgsMapToPixel, int theBandNoInt)
 Drawing routine for multiband image, rendered as a single band image in pseudocolor.
void drawPalettedSingleBandColor (QPainter *theQPainter, QgsRasterViewPort *theRasterViewPort, const QgsMapToPixel *theQgsMapToPixel, int theBandNoInt)
 Drawing routine for single band with a color map.
void drawPalettedSingleBandGray (QPainter *theQPainter, QgsRasterViewPort *theRasterViewPort, const QgsMapToPixel *theQgsMapToPixel, int theBandNoInt)
 Drawing routine for paletted image, rendered as a single band image in grayscale.
void drawPalettedSingleBandPseudoColor (QPainter *theQPainter, QgsRasterViewPort *theRasterViewPort, const QgsMapToPixel *theQgsMapToPixel, int theBandNoInt)
 Drawing routine for paletted image, rendered as a single band image in pseudocolor.
void drawPalettedMultiBandColor (QPainter *theQPainter, QgsRasterViewPort *theRasterViewPort, const QgsMapToPixel *theQgsMapToPixel, int theBandNoInt)
 Drawing routine for paletted multiband image.
void drawSingleBandGray (QPainter *theQPainter, QgsRasterViewPort *theRasterViewPort, const QgsMapToPixel *theQgsMapToPixel, int theBandNoInt)
 Drawing routine for single band grayscale image.
void drawSingleBandPseudoColor (QPainter *theQPainter, QgsRasterViewPort *theRasterViewPort, const QgsMapToPixel *theQgsMapToPixel, int theBandNoInt)
 Drawing routine for single band grayscale image, rendered in pseudocolor.
void closeDataset ()
 Close data set and release related data.
QString generateBandName (int)
 helper function to create zero padded band names
bool hasBand (const QString &theBandName)
 Find out whether a given band exists.
void paintImageToCanvas (QPainter *theQPainter, QgsRasterViewPort *theRasterViewPort, const QgsMapToPixel *theQgsMapToPixel, QImage *theImage)
 Places the rendered image onto the canvas.
QString projectionWkt ()
 Query GDAL to find out the Wkt projection string for this layer.
void * readData (GDALRasterBandH gdalBand, QgsRasterViewPort *viewPort)
 Allocate memory and load data to that allocated memory.
bool readFile (const QString &fileName)
 Load the given raster file.
double readValue (void *data, GDALDataType type, int index)
 Read a raster value given position from memory block created by readData().
bool update ()
 Update the layer if it is outdated.
QString validateBandName (const QString &theBandName)
 Verify and transform band name for internal consistency.

Private Attributes

const QString QSTRING_NOT_SET
 Constant defining flag for XML and a constant that signals property not used.
const QString TRSTRING_NOT_SET
int mBandCount
 The number of bands in the dataset.
QString mBlueBandName
 The band to be associated with the color blue - usually 3.
ColorShadingAlgorithm mColorShadingAlgorithm
 The raster shading algorithm being used.
QgsContrastEnhancement::ContrastEnhancementAlgorithm mContrastEnhancementAlgorithm
 The contrast enhancement algorithm being used.
ContrastEnhancementList mContrastEnhancementList
 List containing the contrast enhancements for each band.
double mStandardDeviations
 Number of stddev to plot (0) to ignore.
QgsRasterDataProvidermDataProvider
 [ data provider interface ] Pointer to data provider derived from the abstract base class QgsDataProvider
DrawingStyle mDrawingStyle
bool mEditable
 [ data provider interface ] Flag indicating whether the layer is in editing mode or not
QString mError
 [ data provider interface ]The error message associated with the last error
QString mErrorCaption
 [ data provider interface ] The error caption associated with the last error
GDALDatasetH mGdalBaseDataset
 Pointer to the gdaldataset.
GDALDatasetH mGdalDataset
 Pointer to the gdaldataset (possibly warped vrt).
double mGeoTransform [6]
 Values for mapping pixel to world coordinates.
QString mGrayBandName
 The band to be associated with the grayscale only output - usually 1.
bool mGrayMinimumMaximumEstimated
 Flag to indicate of the min max values are actual or estimates/user defined.
QString mGreenBandName
 The band to be associated with the color green - usually 2.
bool mHasPyramids
 Whether this raster has overviews / pyramids or not.
int mWidth
 Raster width.
int mHeight
 Raster height.
bool mInvertColor
 Flag indicating whether the color of pixels should be inverted or not.
QDateTime mLastModified
 [ data provider interface ] Timestamp, the last modified time of the data source when the layer was created
QgsRasterViewPort mLastViewPort
QLibrary * mLib
 [ data provider interface ] pointer for loading the provider library
bool mModified
 [ data provider interface ] Flag indicating whether the layer has been modified since the last commit
double mNoDataValue
 Cell value representing no data.
QString mProviderKey
 [ data provider interface ] Data provider key
RasterPyramidList mPyramidList
 This list holds a series of RasterPyramid structs which store information for each potential pyramid level.
QgsRasterShadermRasterShader
 The raster shader for the layer.
RasterStatsList mRasterStatsList
 A collection of stats - one for each band in the layer.
QgsRasterTransparency mRasterTransparency
 The transparency container.
LayerType mRasterType
QString mRedBandName
 The band to be associated with the color red - usually 1.
bool mRGBMinimumMaximumEstimated
 Flag to indicate of the min max values are actual or estimates/user defined.
QString mTransparencyBandName
 The band to be associated with transparency.
bool mUserDefinedGrayMinimumMaximum
 Flag to indicate if the user entered custom min max values.
bool mUserDefinedRGBMinimumMaximum
 Flag to indicate if the user entered custom min max values.
bool mValidNoDataValue
 Flag indicating if the nodatavalue is valid.


Detailed Description

This class provides qgis with the ability to render raster datasets onto the mapcanvas.

The qgsrasterlayer class makes use of gdal for data io, and thus supports any gdal supported format. The constructor attempts to infer what type of file (LayerType) is being opened - not in terms of the file format (tif, ascii grid etc.) but rather in terms of whether the image is a GRAYSCALE, PaletteD or Multiband,

Within the three allowable raster layer types, there are 8 permutations of how a layer can actually be rendered. These are defined in the DrawingStyle enum and consist of:

SingleBandGray -> a GRAYSCALE layer drawn as a range of gray colors (0-255) SingleBandPseudoColor -> a GRAYSCALE layer drawn using a pseudocolor algorithm PalettedSingleBandGray -> a PaletteD layer drawn in gray scale (using only one of the color components) PalettedSingleBandPseudoColor -> a PaletteD layer having only one of its color components rendered as psuedo color PalettedMultiBandColor -> a PaletteD image where the bands contains 24bit color info and 8 bits is pulled out per color MultiBandSingleBandGray -> a layer containing 2 or more bands, but using only one band to produce a grayscale image MultiBandSingleBandPseudoColor -> a layer containing 2 or more bands, but using only one band to produce a pseudocolor image MultiBandColor -> a layer containing 2 or more bands, mapped to the three RGBcolors. In the case of a multiband with only two bands, one band will have to be mapped to more than one color

Each of the above mentioned drawing styles is implemented in its own draw* function. Some of the drawing styles listed above require statistics about the layer such as the min / max / mean / stddev etc. statistics for a band can be gathered using the bandStatistics function. Note that statistics gathering is a slow process and every effort should be made to call this function as few times as possible. For this reason, qgsraster has a vector class member to store stats for each band. The constructor initialises this vector on startup, but only populates the band name and number fields.

Note that where bands are of gdal 'undefined' type, their values may exceed the renderable range of 0-255. Because of this a linear scaling histogram enhanceContrast is applied to undefined layers to normalise the data into the 0-255 range.

A qgsrasterlayer band can be referred to either by name or by number (base=1). It should be noted that band names as stored in datafiles may not be unique, and so the rasterlayer class appends the band number in brackets behind each band name.

Sample usage of the QgsRasterLayer class:

     QString myFileNameQString = "/path/to/file";
     QFileInfo myFileInfo(myFileNameQString);
     QString myBaseNameQString = myFileInfo.baseName();
     QgsRasterLayer *myRasterLayer = new QgsRasterLayer(myFileNameQString, myBaseNameQString);

In order to automate redrawing of a raster layer, you should like it to a map canvas like this :

     QObject::connect( myRasterLayer, SIGNAL(repaintRequested()), mapCanvas, SLOT(refresh()) );

A raster layer can also export its legend as a pixmap:

     QPixmap myQPixmap = myRasterLayer->legendPixmap();

Once a layer has been created you can find out what type of layer it is (GrayOrUndefined, Palette or Multiband):

    if (rasterLayer->rasterType()==QgsRasterLayer::Multiband)
    {
      //do something
    }
    else if (rasterLayer->rasterType()==QgsRasterLayer::Palette)
    {
      //do something
    }
    else // QgsRasterLayer::GrayOrUndefined
    {
      //do something.
    }

You can combine layer type detection with the setDrawingStyle method to override the default drawing style assigned when a layer is loaded:

    if (rasterLayer->rasterType()==QgsRasterLayer::Multiband)
    {
       myRasterLayer->setDrawingStyle(QgsRasterLayer::MultiBandSingleBandPseudoColor);
    }
    else if (rasterLayer->rasterType()==QgsRasterLayer::Palette)
    {
      myRasterLayer->setDrawingStyle(QgsRasterLayer::PalettedSingleBandPseudoColor);
    }
    else // QgsRasterLayer::GrayOrUndefined
    {
      myRasterLayer->setDrawingStyle(QgsRasterLayer::SingleBandPseudoColor);
    }

Raster layers can also have an arbitrary level of transparency defined, and have their color palettes inverted using the setTransparency and setInvertHistogram methods.

Pseudocolor images can have their output adjusted to a given number of standard deviations using the setStandardDeviations method.

The final area of functionality you may be interested in is band mapping. Band mapping allows you to choose arbitrary band -> color mappings and is applicable only to Palette and Multiband rasters, There are four mappings that can be made: red, green, blue and gray. Mappings are non-exclusive. That is a given band can be assigned to no, some or all color mappings. The constructor sets sensible defaults for band mappings but these can be overridden at run time using the setRedBandName, setGreenBandName, setBlueBandName and setGrayBandName methods.

Definition at line 178 of file qgsrasterlayer.h.


Member Typedef Documentation

A list containing on ContrastEnhancement object per raster band in this raster layer.

Definition at line 257 of file qgsrasterlayer.h.

A list containing one RasterPyramid struct per raster band in this raster layer.

POTENTIAL pyramid layer. This works by dividing the height and width of the raster by an incrementing number. As soon as the result of the division is <=256 we stop allowing RasterPyramid structs to be added to the list. Each time a RasterPyramid is created we will check to see if a pyramid matching these dimensions already exists in the raster layer, and if so mark the exists flag as true

Definition at line 266 of file qgsrasterlayer.h.

A list containing one RasterBandStats struct per raster band in this raster layer.

Note that while every RasterBandStats element will have the name and number of its associated band populated, any additional stats are calculated on a need to know basis.

Definition at line 271 of file qgsrasterlayer.h.


Member Enumeration Documentation

This enumerator describes the types of shading that can be used.

Enumerator:
UndefinedShader 
PseudoColorShader 
FreakOutShader 
ColorRampShader 
UserDefinedShader 

Definition at line 221 of file qgsrasterlayer.h.

This enumerator describes the different kinds of drawing we can do.

Enumerator:
UndefinedDrawingStyle 
SingleBandGray 
SingleBandPseudoColor 
PalettedColor 
PalettedSingleBandGray 
PalettedSingleBandPseudoColor 
PalettedMultiBandColor 
MultiBandSingleGandGray 
MultiBandSingleBandGray 
MultiBandSingleBandPseudoColor 
MultiBandColor 

Definition at line 231 of file qgsrasterlayer.h.

This enumerator describes the type of raster layer.

Enumerator:
GrayOrUndefined 
Palette 
Multiband 

Reimplemented from QgsMapLayer.

Definition at line 249 of file qgsrasterlayer.h.


Constructor & Destructor Documentation

QgsRasterLayer::QgsRasterLayer ( const QString &  path = QString::null,
const QString &  baseName = QString::null,
bool  loadDefaultStyleFlag = true 
)

QgsRasterLayer::QgsRasterLayer ( int  dummy,
const QString &  baseName = QString(),
const QString &  path = QString(),
const QString &  providerLib = QString(),
const QStringList &  layers = QStringList(),
const QStringList &  styles = QStringList(),
const QString &  format = QString(),
const QString &  crs = QString() 
)

[ data provider interface ] Constructor in provider mode

Todo:
Rename into a general constructor when the old raster interface is retired parameter dummy is just there to distinguish this function signature from the old non-provider one.

Definition at line 178 of file qgsrasterlayer.cpp.

References mBandCount, mDataProvider, mGeoTransform, mRasterShader, QgsDebugMsg, setDataProvider(), showStatusMessage(), and QgsMapLayer::statusChanged().

QgsRasterLayer::~QgsRasterLayer (  ) 

The destructor.

Definition at line 243 of file qgsrasterlayer.cpp.

References mGdalBaseDataset, mGdalDataset, mProviderKey, and mRasterShader.


Member Function Documentation

void QgsRasterLayer::buildSupportedRasterFileFilter ( QString &  theFileFiltersString  )  [static]

Builds the list of file filter strings to later be used by QgisApp::addRasterLayer().

We query GDAL for a list of supported raster formats; we then build a list of file filter strings from that list. We return a string that contains this list that is suitable for use in a QFileDialog::getOpenFileNames() call.

Definition at line 280 of file qgsrasterlayer.cpp.

References QgsDebugMsg, registerGdalDrivers(), and QgsLogger::warning().

bool QgsRasterLayer::isValidRasterFileName ( const QString &  theFileNameQString,
QString &  retError 
) [static]

This helper checks to see whether the file name appears to be a valid raster file name.

This helper checks to see whether the file name appears to be a valid raster file name.

If the file name looks like it could be valid, but some sort of error occurs in processing the file, the error is returned in retError.

Definition at line 452 of file qgsrasterlayer.cpp.

References registerGdalDrivers(), subLayers(), and TO8F.

Referenced by isValidRasterFileName().

bool QgsRasterLayer::isValidRasterFileName ( const QString &  theFileNameQString  )  [static]

Definition at line 486 of file qgsrasterlayer.cpp.

References isValidRasterFileName().

QStringList QgsRasterLayer::subLayers ( GDALDatasetH  dataset  )  [static]

Definition at line 3619 of file qgsrasterlayer.cpp.

References metadata(), QgsDebugMsg, and subLayers().

QDateTime QgsRasterLayer::lastModified ( const QString &  name  )  [static]

Return time stamp for given file name.

Definition at line 492 of file qgsrasterlayer.cpp.

References QgsDebugMsg.

Referenced by readFile(), and update().

void QgsRasterLayer::registerGdalDrivers (  )  [static]

ensures that GDAL drivers are registered, but only once

Definition at line 511 of file qgsrasterlayer.cpp.

Referenced by buildSupportedRasterFileFilter(), isValidRasterFileName(), and readFile().

QString QgsRasterLayer::blueBandName (  )  const [inline]

Accessor for blue band name mapping.

Definition at line 306 of file qgsrasterlayer.h.

Referenced by setMinimumMaximumUsingLastExtent(), and writeSymbology().

QgsRasterLayer::ColorShadingAlgorithm QgsRasterLayer::colorShadingAlgorithm (  )  const [inline]

Accessor for color shader algorithm.

Definition at line 309 of file qgsrasterlayer.h.

Referenced by writeSymbology().

QgsContrastEnhancement::ContrastEnhancementAlgorithm QgsRasterLayer::contrastEnhancementAlgorithm (  )  [inline]

Accessor for contrast enhancement algorithm.

Definition at line 312 of file qgsrasterlayer.h.

Referenced by drawMultiBandColor(), and drawSingleBandGray().

QString QgsRasterLayer::contrastEnhancementAlgorithmAsString (  )  const

DrawingStyle QgsRasterLayer::drawingStyle (  )  [inline]

Accessor for drawing style.

Definition at line 318 of file qgsrasterlayer.h.

Referenced by setMinimumMaximumUsingLastExtent().

QString QgsRasterLayer::grayBandName (  )  const [inline]

Accessor for gray band name mapping.

Definition at line 321 of file qgsrasterlayer.h.

Referenced by setMinimumMaximumUsingLastExtent(), and writeSymbology().

QString QgsRasterLayer::greenBandName (  )  const [inline]

Accessor for green band name mapping.

Definition at line 324 of file qgsrasterlayer.h.

Referenced by setMinimumMaximumUsingLastExtent(), and writeSymbology().

bool QgsRasterLayer::hasPyramids (  )  [inline]

Accessor for mHasPyramids (READ ONLY).

Definition at line 327 of file qgsrasterlayer.h.

bool QgsRasterLayer::hasUserDefinedGrayMinimumMaximum (  )  const [inline]

Accessor for mUserDefinedGrayMinimumMaximum.

Definition at line 330 of file qgsrasterlayer.h.

Referenced by writeSymbology().

bool QgsRasterLayer::hasUserDefinedRGBMinimumMaximum (  )  const [inline]

Accessor for mUserDefinedRGBMinimumMaximum.

Definition at line 333 of file qgsrasterlayer.h.

Referenced by writeSymbology().

int QgsRasterLayer::height (  )  [inline]

Accessor that returns the height of the (unclipped) raster.

Definition at line 336 of file qgsrasterlayer.h.

bool QgsRasterLayer::invertHistogram (  )  const [inline]

Accessor to find out whether the histogram should be inverted.

Definition at line 339 of file qgsrasterlayer.h.

Referenced by writeSymbology().

bool QgsRasterLayer::isNoDataValueValid (  )  const [inline]

Is the NoDataValue Valid.

Definition at line 342 of file qgsrasterlayer.h.

bool QgsRasterLayer::isGrayMinimumMaximumEstimated (  )  const [inline]

Accessor for mGrayMinimumMaximumEstimated.

Definition at line 345 of file qgsrasterlayer.h.

Referenced by writeSymbology().

bool QgsRasterLayer::isRGBMinimumMaximumEstimated (  )  const [inline]

Accessor for mRGBMinimumMaximumEstimated.

Definition at line 348 of file qgsrasterlayer.h.

Referenced by writeSymbology().

double QgsRasterLayer::noDataValue ( bool *  isValid = 0  )  [inline]

Accessor that returns the NO_DATA entry for this raster.

Definition at line 351 of file qgsrasterlayer.h.

QgsRasterTransparency* QgsRasterLayer::rasterTransparency (  )  [inline]

Returns a pointer to the transparency object.

Definition at line 354 of file qgsrasterlayer.h.

QgsRasterShader* QgsRasterLayer::rasterShader (  )  [inline]

Accessor for raster shader.

Definition at line 357 of file qgsrasterlayer.h.

LayerType QgsRasterLayer::rasterType (  )  [inline]

Accessor for raster layer type (which is a read only property).

Definition at line 360 of file qgsrasterlayer.h.

Referenced by setMinimumMaximumUsingLastExtent().

QString QgsRasterLayer::redBandName (  )  const [inline]

Accessor for red band name (allows alternate mappings e.g.

map blue as red color)

Definition at line 363 of file qgsrasterlayer.h.

Referenced by setMinimumMaximumUsingLastExtent(), and writeSymbology().

void QgsRasterLayer::setDataProvider ( const QString &  provider,
const QStringList &  layers,
const QStringList &  styles,
const QString &  format,
const QString &  crs 
)

void QgsRasterLayer::setDrawingStyle ( const DrawingStyle theDrawingStyle  )  [inline]

Mutator for drawing style.

Definition at line 373 of file qgsrasterlayer.h.

Referenced by readSymbology().

void QgsRasterLayer::setGrayMinimumMaximumEstimated ( bool  theBool  )  [inline]

Mutator for mGrayMinimumMaximumEstimated.

Definition at line 376 of file qgsrasterlayer.h.

Referenced by readSymbology().

void QgsRasterLayer::setInvertHistogram ( bool  theFlag  )  [inline]

Mutator to alter the state of the invert histogram flag.

Definition at line 379 of file qgsrasterlayer.h.

Referenced by readSymbology().

void QgsRasterLayer::setRGBMinimumMaximumEstimated ( bool  theBool  )  [inline]

Mutator for mRGBMinimumMaximumEstimated.

Definition at line 382 of file qgsrasterlayer.h.

Referenced by readSymbology().

void QgsRasterLayer::setStandardDeviations ( double  theStandardDeviations  )  [inline]

Mutator to alter the number of standard deviations that should be plotted.

Definition at line 385 of file qgsrasterlayer.h.

Referenced by readSymbology().

void QgsRasterLayer::setUserDefinedGrayMinimumMaximum ( bool  theBool  )  [inline]

Mutator for mUserDefinedGrayMinimumMaximum.

Definition at line 388 of file qgsrasterlayer.h.

Referenced by readSymbology(), and setMinimumMaximumUsingLastExtent().

void QgsRasterLayer::setUserDefinedRGBMinimumMaximum ( bool  theBool  )  [inline]

Mutator for mUserDefinedRGBMinimumMaximum.

Definition at line 391 of file qgsrasterlayer.h.

Referenced by readSymbology(), and setMinimumMaximumUsingLastExtent().

double QgsRasterLayer::standardDeviations (  )  const [inline]

Accessor to find out how many standard deviations are being plotted.

Definition at line 394 of file qgsrasterlayer.h.

Referenced by writeSymbology().

QString QgsRasterLayer::transparentBandName (  )  const [inline]

Accessor for transparent band name mapping.

Definition at line 397 of file qgsrasterlayer.h.

bool QgsRasterLayer::usesProvider (  ) 

[ data provider interface ] Does this layer use a provider for setting/retrieving data?

Definition at line 5596 of file qgsrasterlayer.cpp.

References mProviderKey.

Referenced by update().

int QgsRasterLayer::width (  )  [inline]

Accessor that returns the width of the (unclipped) raster.

Definition at line 403 of file qgsrasterlayer.h.

unsigned int QgsRasterLayer::bandCount (  ) 

const QString QgsRasterLayer::bandName ( int  theBandNoInt  ) 

Get the name of a band given its number.

Definition at line 633 of file qgsrasterlayer.cpp.

References mRasterStatsList.

Referenced by metadata(), readFile(), and validateBandName().

int QgsRasterLayer::bandNumber ( const QString &  theBandName  ) 

Get the number of a band given its name.

The name is the rewritten name set up in the constructor, and will not necessarily be the same as the name retrieved directly from gdal! If no matching band is found zero will be returned!

Definition at line 646 of file qgsrasterlayer.cpp.

References QgsRasterBandStats::bandName, QgsRasterBandStats::bandNumber, mRasterStatsList, and QgsDebugMsg.

Referenced by computeMinimumMaximumEstimates(), computeMinimumMaximumFromLastExtent(), draw(), drawMultiBandColor(), maximumValue(), minimumValue(), setMaximumValue(), and setMinimumValue().

const QgsRasterBandStats QgsRasterLayer::bandStatistics ( int  theBandNo  ) 

Get RasterBandStats for a band given its number (read only).

Private method to calculate statistics for a band.

Populates rasterStatsMemArray. Calculates:

  • myRasterBandStats.elementCount
  • myRasterBandStats.minimumValue
  • myRasterBandStats.maximumValue
  • myRasterBandStats.sum
  • myRasterBandStats.range
  • myRasterBandStats.mean
  • myRasterBandStats.sumOfSquares
  • myRasterBandStats.stdDev
  • myRasterBandStats.colorTable

See also:
RasterBandStats
Note:
This is a cpu intensive and slow task!

Definition at line 688 of file qgsrasterlayer.cpp.

References QgsRasterBandStats::bandNumber, QgsLogger::debug(), QgsMapLayer::drawingProgress(), QgsRasterBandStats::elementCount, QgsRasterBandStats::maximumValue, QgsRasterBandStats::mean, mGdalDataset, mHeight, QgsRasterBandStats::minimumValue, mNoDataValue, mRasterStatsList, mRasterType, mValidNoDataValue, QgsMapLayer::name(), Palette, QgsDebugMsg, QgsRasterBandStats::range, readValue(), QgsRasterBandStats::statsGathered, QgsMapLayer::statusChanged(), QgsRasterBandStats::stdDev, QgsRasterBandStats::sum, QgsRasterBandStats::sumOfSquares, and TINY_VALUE.

Referenced by bandStatistics(), drawMultiBandColor(), drawPalettedSingleBandPseudoColor(), drawSingleBandGray(), drawSingleBandPseudoColor(), metadata(), and populateHistogram().

const QgsRasterBandStats QgsRasterLayer::bandStatistics ( const QString &  theBandName  ) 

Get RasterBandStats for a band given its name (read only).

Definition at line 935 of file qgsrasterlayer.cpp.

References QgsRasterBandStats::bandName, bandStatistics(), and mGdalDataset.

QgsRasterLayer::RasterPyramidList QgsRasterLayer::buildPyramidList (  ) 

Accessor for ths raster layers pyramid list.

A pyramid list defines the POTENTIAL pyramids that can be in a raster. To know which of the pyramid layers ACTUALLY exists you need to look at the existsFlag member in each struct stored in the list.

Definition at line 1122 of file qgsrasterlayer.cpp.

References QgsLogger::debug(), QgsRasterPyramid::exists, QgsRasterPyramid::level, mDataProvider, mGdalDataset, mHeight, mPyramidList, mWidth, QgsDebugMsg, QgsRasterPyramid::xDim, and QgsRasterPyramid::yDim.

Referenced by readFile().

QString QgsRasterLayer::colorShadingAlgorithmAsString (  )  const

Accessor for color shader algorithm.

Definition at line 1203 of file qgsrasterlayer.cpp.

References ColorRampShader, FreakOutShader, mColorShadingAlgorithm, PseudoColorShader, and UserDefinedShader.

Referenced by writeSymbology().

void QgsRasterLayer::computeMinimumMaximumEstimates ( int  theBand,
double *  theMinMax 
)

Wrapper for GDALComputeRasterMinMax with the estimate option.

Parameters:
theBand The band (number) for which to estimate the min max values
theMinMax Pointer to a double[2] which hold the estimated min max

Definition at line 1230 of file qgsrasterlayer.cpp.

References bandCount(), and mGdalDataset.

Referenced by computeMinimumMaximumEstimates().

void QgsRasterLayer::computeMinimumMaximumEstimates ( QString  theBand,
double *  theMinMax 
)

Wrapper for GDALComputeRasterMinMax with the estimate option.

Parameters:
theBand The band (name) for which to estimate the min max values
theMinMax Pointer to a double[2] which hold the estimated min max

Definition at line 1245 of file qgsrasterlayer.cpp.

References bandNumber(), and computeMinimumMaximumEstimates().

void QgsRasterLayer::computeMinimumMaximumEstimates ( int  theBand,
double &  theMin,
double &  theMax 
)

Wrapper for GDALComputeRasterMinMax with the estimate option.

Note:
added in v1.6

Definition at line 1250 of file qgsrasterlayer.cpp.

References computeMinimumMaximumEstimates().

void QgsRasterLayer::computeMinimumMaximumFromLastExtent ( int  theBand,
double *  theMinMax 
)

Compute the actual minimum maximum pixel values based on the current (last) display extent.

Parameters:
theBand The band (number) for which to calculate the min max values
theMinMax Pointer to a double[2] which hold the estimated min max

Definition at line 1262 of file qgsrasterlayer.cpp.

References bandCount(), QgsRasterViewPort::drawableAreaXDim, QgsRasterViewPort::drawableAreaYDim, MathUtils::max(), mGdalDataset, mLastViewPort, mNoDataValue, mValidNoDataValue, readData(), readValue(), and TINY_VALUE.

Referenced by computeMinimumMaximumFromLastExtent(), and setMinimumMaximumUsingLastExtent().

void QgsRasterLayer::computeMinimumMaximumFromLastExtent ( QString  theBand,
double *  theMinMax 
)

Compute the actual minimum maximum pixel values based on the current (last) display extent.

Parameters:
theBand The band (name) for which to calculate the min max values
theMinMax Pointer to a double[2] which hold the estimated min max

Definition at line 1303 of file qgsrasterlayer.cpp.

References bandNumber(), and computeMinimumMaximumFromLastExtent().

void QgsRasterLayer::computeMinimumMaximumFromLastExtent ( int  theBand,
double &  theMin,
double &  theMax 
)

Compute the actual minimum maximum pixel values based on the current (last) display extent.

Note:
added in v1.6

Definition at line 1308 of file qgsrasterlayer.cpp.

References computeMinimumMaximumFromLastExtent().

QgsContrastEnhancement * QgsRasterLayer::contrastEnhancement ( unsigned int  theBand  ) 

Get a pointer to the contrast enhancement for the selected band.

Parameters:
theBand The band (number) for which to get the contrast enhancement for
Returns:
Pointer to the contrast enhancement or 0 on failure

Definition at line 1320 of file qgsrasterlayer.cpp.

References bandCount(), and mContrastEnhancementList.

Referenced by drawMultiBandColor(), and drawSingleBandGray().

bool QgsRasterLayer::copySymbologySettings ( const QgsMapLayer theOther  )  [virtual]

Copies the symbology settings from another layer.

Returns true in case of success

Note:
Note implemented yet
Returns:
always returns false

Implements QgsMapLayer.

Definition at line 1358 of file qgsrasterlayer.cpp.

References QgsMapLayer::type().

QList< QgsColorRampShader::ColorRampItem > * QgsRasterLayer::colorTable ( int  theBandNo  ) 

Get a pointer to the color table.

Parameters:
theBandNo the band number
Returns:
pointer to the color table

Definition at line 1372 of file qgsrasterlayer.cpp.

References mRasterStatsList.

Referenced by readFile().

QgsRasterDataProvider * QgsRasterLayer::dataProvider (  ) 

Returns the data provider.

Returns:
0 if not using the data provider model (i.e. directly using GDAL)

Definition at line 1380 of file qgsrasterlayer.cpp.

References mDataProvider.

Referenced by QgsComposerMap::containsWMSLayer().

const QgsRasterDataProvider * QgsRasterLayer::dataProvider (  )  const

Returns the data provider in a const-correct manner.

Returns:
0 if not using the data provider model (i.e. directly using GDAL)

Definition at line 1388 of file qgsrasterlayer.cpp.

References mDataProvider.

void QgsRasterLayer::reload (  )  [virtual]

Synchronises with changes in the datasource.

Note:
added in version 1.6

Reimplemented from QgsMapLayer.

Definition at line 1393 of file qgsrasterlayer.cpp.

References mDataProvider, and QgsDataProvider::reloadData().

bool QgsRasterLayer::draw ( QgsRenderContext rendererContext  )  [virtual]

void QgsRasterLayer::draw ( QPainter *  theQPainter,
QgsRasterViewPort myRasterViewPort,
const QgsMapToPixel theQgsMapToPixel = 0 
)

QString QgsRasterLayer::drawingStyleAsString (  )  const

Returns a string representation of drawing style.

Implemented mainly for serialisation / deserialisation of settings to xml. NOTE: May be deprecated in the future!. DrawingStyle drawingStyle() instead.

Definition at line 1835 of file qgsrasterlayer.cpp.

References mDrawingStyle, MultiBandColor, MultiBandSingleBandGray, MultiBandSingleBandPseudoColor, PalettedColor, PalettedMultiBandColor, PalettedSingleBandGray, PalettedSingleBandPseudoColor, SingleBandGray, and SingleBandPseudoColor.

Referenced by legendAsPixmap(), readSymbology(), and writeSymbology().

bool QgsRasterLayer::hasCompatibleSymbology ( const QgsMapLayer theOther  )  const [virtual]

Checks if symbology is the same as another layers.

Note:
Note implemented yet
Returns:
always returns false

Implements QgsMapLayer.

Definition at line 1878 of file qgsrasterlayer.cpp.

References QgsMapLayer::type().

bool QgsRasterLayer::hasStatistics ( int  theBandNo  ) 

Check whether a given band number has stats associated with it.

Parameters:
theBandNo The number of the band to check
Returns:
true if statistics have already been build for this band otherwise false

Definition at line 1892 of file qgsrasterlayer.cpp.

References mRasterStatsList.

Referenced by metadata().

bool QgsRasterLayer::identify ( const QgsPoint thePoint,
QMap< QString, QString > &  theResults 
)

Identify raster value(s) found on the point position.

Parameters:
thePoint the QgsPoint for which to obtain pixel values
theResults QMap to hold the pixel values at thePoint for each layer in the raster file
Returns:
False if WMS layer and true otherwise

Definition at line 1910 of file qgsrasterlayer.cpp.

References QgsRectangle::contains(), QgsLogger::debug(), generateBandName(), QgsRasterDataProvider::identify(), mDataProvider, mGdalDataset, mHeight, QgsMapLayer::mLayerExtent, mNoDataValue, mProviderKey, mValidNoDataValue, mWidth, QgsDebugMsg, readValue(), TINY_VALUE, QgsPoint::toString(), QgsMapLayer::type(), QgsLogger::warning(), QgsPoint::x(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsPoint::y(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().

QString QgsRasterLayer::identifyAsText ( const QgsPoint thePoint  ) 

Identify arbitrary details from the WMS server found on the point position.

Note:
The arbitraryness of the returned document is enforced by WMS standards up to at least v1.3.0
Parameters:
thePoint an image pixel coordinate in the last requested extent of layer.
Returns:
A text document containing the return from the WMS server

Definition at line 1994 of file qgsrasterlayer.cpp.

References QgsRasterDataProvider::identifyAsText(), mDataProvider, and mProviderKey.

QString QgsRasterLayer::identifyAsHtml ( const QgsPoint thePoint  ) 

Identify arbitrary details from the WMS server found on the point position.

Note:
added in 1.5

The arbitraryness of the returned document is enforced by WMS standards up to at least v1.3.0

Parameters:
thePoint an image pixel coordinate in the last requested extent of layer.
Returns:
A html document containing the return from the WMS server

Definition at line 2011 of file qgsrasterlayer.cpp.

References QgsRasterDataProvider::identifyAsHtml(), mDataProvider, and mProviderKey.

bool QgsRasterLayer::isEditable (  )  const [virtual]

Currently returns always false.

Note:
Note implemented yet
Returns:
Always returns false

Reimplemented from QgsMapLayer.

Definition at line 2026 of file qgsrasterlayer.cpp.

QString QgsRasterLayer::lastError (  )  [virtual]

[ data provider interface ] If an operation returns 0 (e.g.

draw()), this function returns the text of the error associated with the failure

Reimplemented from QgsMapLayer.

Definition at line 2031 of file qgsrasterlayer.cpp.

References mError.

QString QgsRasterLayer::lastErrorTitle (  )  [virtual]

[ data provider interface ] If an operation returns 0 (e.g.

draw()), this function returns the text of the error associated with the failure

Reimplemented from QgsMapLayer.

Definition at line 2036 of file qgsrasterlayer.cpp.

References mErrorCaption.

QPixmap QgsRasterLayer::legendAsPixmap (  ) 

Get a legend image for this layer.

This is an overloaded version of the legendAsPixmap( bool ) assumes false for the legend name flag.

Returns:
a pixmap representing a legend image

Definition at line 2045 of file qgsrasterlayer.cpp.

Referenced by QgsLegendModel::addRasterLayerItem().

QPixmap QgsRasterLayer::legendAsPixmap ( bool  theWithNameFlag  ) 

Overloaded version of above function that can print layer name onto legend.

Parameters:
theWithNameFlag - boolena flag whether to overlay the legend name in the text
Returns:
a pixmap representing a legend image

Definition at line 2054 of file qgsrasterlayer.cpp.

References QgsApplication::activeThemePath(), drawingStyleAsString(), FreakOutShader, mColorShadingAlgorithm, mDrawingStyle, mGdalDataset, mHasPyramids, mInvertColor, mProviderKey, MultiBandColor, MultiBandSingleBandGray, MultiBandSingleBandPseudoColor, QgsMapLayer::name(), PalettedColor, PalettedMultiBandColor, PalettedSingleBandGray, PalettedSingleBandPseudoColor, QgsDebugMsg, SingleBandGray, and SingleBandPseudoColor.

QPixmap QgsRasterLayer::legendAsPixmap ( int  theLabelCount  ) 

Use this method when you want an annotated legend suitable for print output etc.

Parameters:
theLabelCount number of vertical labels to display
Returns:
a pixmap representing a legend image

Definition at line 2325 of file qgsrasterlayer.cpp.

References FreakOutShader, mColorShadingAlgorithm, mDrawingStyle, mGdalDataset, mInvertColor, MultiBandColor, MultiBandSingleBandGray, MultiBandSingleBandPseudoColor, QgsMapLayer::name(), PalettedMultiBandColor, PalettedSingleBandGray, PalettedSingleBandPseudoColor, QgsDebugMsg, SingleBandGray, and SingleBandPseudoColor.

double QgsRasterLayer::maximumValue ( unsigned int  theBand  ) 

Accessor for maximum value user for contrast enhancement.

Parameters:
theBand the band number for which to get the maximum pixel value
Returns:
the maximum pixel value

Definition at line 2556 of file qgsrasterlayer.cpp.

References bandCount(), and mContrastEnhancementList.

Referenced by maximumValue().

double QgsRasterLayer::maximumValue ( QString  theBand  ) 

Accessor for maximum value user for contrast enhancement.

Parameters:
theBand the band name for which to get the maximum pixel value
Returns:
the maximum pixel value

Definition at line 2570 of file qgsrasterlayer.cpp.

References bandNumber(), and maximumValue().

QString QgsRasterLayer::metadata (  ) 

double QgsRasterLayer::minimumValue ( unsigned int  theBand  ) 

Accessor for minimum value user for contrast enhancement.

Parameters:
theBand the band number for which to get the minimum pixel value
Returns:
the minimum pixel value

Definition at line 2914 of file qgsrasterlayer.cpp.

References bandCount(), and mContrastEnhancementList.

Referenced by minimumValue().

double QgsRasterLayer::minimumValue ( QString  theBand  ) 

Accessor for minimum value user for contrast enhancement.

Parameters:
theBand the band name for which to get the minimum pixel value
Returns:
the minimum pixel value

Definition at line 2928 of file qgsrasterlayer.cpp.

References bandNumber(), and minimumValue().

QPixmap QgsRasterLayer::paletteAsPixmap ( int  theBandNumber = 1  ) 

Get an 100x100 pixmap of the color palette.

If the layer has no palette a white pixmap will be returned

Parameters:
theBandNumber the number of the band to use for generating a pixmap of the associated palette
Returns:
a 100x100 pixel QPixmap of the bands palette

Definition at line 2937 of file qgsrasterlayer.cpp.

References QgsColorRampShader::colorRampItemList(), QgsColorRampShader::DISCRETE, hasBand(), mProviderKey, QgsDebugMsg, readColorTable(), QgsColorRampShader::setColorRampItemList(), QgsColorRampShader::setColorRampType(), and QgsColorRampShader::shade().

QString QgsRasterLayer::providerKey (  ) 

[ data provider interface ] Which provider is being used for this Raster Layer?

Definition at line 3048 of file qgsrasterlayer.cpp.

References mProviderKey.

double QgsRasterLayer::rasterUnitsPerPixel (  ) 

Returns the number of raster units per each raster pixel.

In a world file, this is normally the first row (without the sign)

Returns:
the horizontal units per pixel as reported in the GDAL geotramsform[1]

Definition at line 3063 of file qgsrasterlayer.cpp.

References mGeoTransform.

bool QgsRasterLayer::readColorTable ( int  theBandNumber,
QList< QgsColorRampShader::ColorRampItem > *  theList 
)

Read color table from GDAL raster band.

Parameters:
theBandNumber the number of the band for which you want a color table
theList a pointer the object that will hold the color table
Returns:
true of a color table was able to be read, false otherwise

Definition at line 3079 of file qgsrasterlayer.cpp.

References QgsColorRampShader::ColorRampItem::color, QgsColorRampShader::ColorRampItem::label, mGdalDataset, QgsDebugMsg, and QgsColorRampShader::ColorRampItem::value.

Referenced by paletteAsPixmap(), and readFile().

void QgsRasterLayer::resetNoDataValue (  ) 

Simple reset function that set the noDataValue back to the value stored in the first raster band.

Definition at line 3163 of file qgsrasterlayer.cpp.

References MathUtils::max(), mGdalDataset, mNoDataValue, mValidNoDataValue, and setNoDataValue().

void QgsRasterLayer::setBlueBandName ( const QString &  theBandName  ) 

Mutator for blue band name mapping.

Definition at line 3186 of file qgsrasterlayer.cpp.

References mBlueBandName, and validateBandName().

Referenced by readSymbology().

void QgsRasterLayer::setColorShadingAlgorithm ( QgsRasterLayer::ColorShadingAlgorithm  theShaderAlgorithm  ) 

void QgsRasterLayer::setColorShadingAlgorithm ( QString  theShaderAlgorithm  ) 

Mutator for color shader algorithm.

Definition at line 3348 of file qgsrasterlayer.cpp.

References ColorRampShader, FreakOutShader, PseudoColorShader, QgsDebugMsg, setColorShadingAlgorithm(), UndefinedShader, and UserDefinedShader.

void QgsRasterLayer::setContrastEnhancementAlgorithm ( QgsContrastEnhancement::ContrastEnhancementAlgorithm  theAlgorithm,
bool  theGenerateLookupTableFlag = true 
)

Mutator for contrast enhancement algorithm.

Definition at line 3364 of file qgsrasterlayer.cpp.

References mContrastEnhancementAlgorithm, and mContrastEnhancementList.

Referenced by readFile(), readSymbology(), and setContrastEnhancementAlgorithm().

void QgsRasterLayer::setContrastEnhancementAlgorithm ( QString  theAlgorithm,
bool  theGenerateLookupTableFlag = true 
)

void QgsRasterLayer::setContrastEnhancementFunction ( QgsContrastEnhancementFunction theFunction  ) 

Mutator for contrast enhancement function.

Definition at line 3405 of file qgsrasterlayer.cpp.

References mContrastEnhancementList.

void QgsRasterLayer::setDrawingStyle ( const QString &  theDrawingStyleQString  ) 

Overloaded version of the above function for convenience when restoring from xml.

Implemented mainly for serialisation / deserialisation of settings to xml.

Note:
May be deprecated in the future! Use setDrawingStyle( DrawingStyle ) instead.

Definition at line 3423 of file qgsrasterlayer.cpp.

References mDrawingStyle, MultiBandColor, MultiBandSingleBandGray, MultiBandSingleBandPseudoColor, PalettedColor, PalettedMultiBandColor, PalettedSingleBandGray, PalettedSingleBandPseudoColor, SingleBandGray, SingleBandPseudoColor, and UndefinedDrawingStyle.

void QgsRasterLayer::setGrayBandName ( const QString &  theBandName  ) 

Mutator for gray band name mapping.

Definition at line 3467 of file qgsrasterlayer.cpp.

References mGrayBandName, and validateBandName().

Referenced by readSymbology().

void QgsRasterLayer::setGreenBandName ( const QString &  theBandName  ) 

Mutator for green band name mapping.

Definition at line 3472 of file qgsrasterlayer.cpp.

References mGreenBandName, and validateBandName().

Referenced by readSymbology().

void QgsRasterLayer::setMaximumValue ( unsigned int  theBand,
double  theValue,
bool  theGenerateLookupTableFlag = true 
)

Mutator for setting the maximum value for contrast enhancement.

Definition at line 3489 of file qgsrasterlayer.cpp.

References bandCount(), and mContrastEnhancementList.

Referenced by drawMultiBandColor(), drawSingleBandGray(), readSymbology(), setMaximumValue(), and setMinimumMaximumUsingLastExtent().

void QgsRasterLayer::setMaximumValue ( QString  theBand,
double  theValue,
bool  theGenerateLookupTableFlag = true 
)

Mutator for setting the maximum value for contrast enhancement.

Definition at line 3497 of file qgsrasterlayer.cpp.

References bandNumber(), and setMaximumValue().

void QgsRasterLayer::setMinimumMaximumUsingLastExtent (  ) 

Sets the minimum and maximum values for the band(s) currently being displayed using the only pixel values from the last/current extent.

Definition at line 3505 of file qgsrasterlayer.cpp.

References blueBandName(), computeMinimumMaximumFromLastExtent(), drawingStyle(), grayBandName(), GrayOrUndefined, greenBandName(), Multiband, MultiBandSingleBandGray, rasterType(), redBandName(), setMaximumValue(), setMinimumValue(), setUserDefinedGrayMinimumMaximum(), setUserDefinedRGBMinimumMaximum(), and SingleBandGray.

void QgsRasterLayer::setMinimumValue ( unsigned int  theBand,
double  theValue,
bool  theGenerateLookupTableFlag = true 
)

Mutator for setting the minimum value for contrast enhancement.

Definition at line 3534 of file qgsrasterlayer.cpp.

References bandCount(), and mContrastEnhancementList.

Referenced by drawMultiBandColor(), drawSingleBandGray(), readSymbology(), setMinimumMaximumUsingLastExtent(), and setMinimumValue().

void QgsRasterLayer::setMinimumValue ( QString  theBand,
double  theValue,
bool  theGenerateLookupTableFlag = true 
)

Mutator for setting the minimum value for contrast enhancement.

Definition at line 3542 of file qgsrasterlayer.cpp.

References bandNumber(), and setMinimumValue().

void QgsRasterLayer::setNoDataValue ( double  theNoData  ) 

Mutator that allows the NO_DATA entry for this raster to be overridden.

Definition at line 3551 of file qgsrasterlayer.cpp.

References mNoDataValue, mRasterStatsList, and mValidNoDataValue.

Referenced by readSymbology(), and resetNoDataValue().

void QgsRasterLayer::setRasterShaderFunction ( QgsRasterShaderFunction theFunction  ) 

Set the raster shader function to a user defined function.

Note:
ownership of the shader function is transfered to raster shader

Definition at line 3567 of file qgsrasterlayer.cpp.

References mColorShadingAlgorithm, mRasterShader, QgsRasterShader::setRasterShaderFunction(), UndefinedShader, and UserDefinedShader.

void QgsRasterLayer::setRedBandName ( const QString &  theBandName  ) 

Mutator for red band name (allows alternate mappings e.g.

map blue as red color)

Definition at line 3582 of file qgsrasterlayer.cpp.

References mRedBandName, QgsDebugMsg, and validateBandName().

Referenced by readSymbology().

void QgsRasterLayer::setTransparentBandName ( const QString &  theBandName  ) 

Mutator for transparent band name mapping.

Definition at line 3599 of file qgsrasterlayer.cpp.

References mTransparencyBandName, and validateBandName().

void QgsRasterLayer::showProgress ( int  theValue  ) 

[ data provider interface ] A wrapper function to emit a progress update signal

Definition at line 3604 of file qgsrasterlayer.cpp.

References progressUpdate().

Referenced by progressCallback().

QStringList QgsRasterLayer::subLayers (  )  const

Returns the sublayers of this layer - Useful for providers that manage their own layers, such as WMS.

Definition at line 3643 of file qgsrasterlayer.cpp.

References mDataProvider, mGdalDataset, and QgsDataProvider::subLayers().

Referenced by isValidRasterFileName(), readFile(), subLayers(), and writeSymbology().

void QgsRasterLayer::thumbnailAsPixmap ( QPixmap *  theQPixmap  ) 

void QgsRasterLayer::thumbnailAsImage ( QImage *  thepImage  ) 

void QgsRasterLayer::triggerRepaint (  ) 

Emit a signal asking for a repaint.

(inherited from maplayer)

Definition at line 3721 of file qgsrasterlayer.cpp.

References QgsMapLayer::repaintRequested().

void QgsRasterLayer::setLayerOrder ( const QStringList &  layers  )  [virtual]

Reorders the *previously selected* sublayers of this layer from bottom to top.

(Useful for providers that manage their own layers, such as WMS)

Definition at line 3477 of file qgsrasterlayer.cpp.

References mDataProvider, QgsDebugMsg, and QgsDataProvider::setLayerOrder().

void QgsRasterLayer::setSubLayerVisibility ( const QString &  name,
bool  vis 
) [virtual]

Set the visibility of the given sublayer name.

Definition at line 3588 of file qgsrasterlayer.cpp.

References mDataProvider, QgsDebugMsg, and QgsDataProvider::setSubLayerVisibility().

QString QgsRasterLayer::buildPyramids ( const RasterPyramidList theRasterPyramidList,
const QString &  theResamplingMethod = "NEAREST",
bool  theTryInternalFlag = false 
) [slot]

void QgsRasterLayer::populateHistogram ( int  theBandNoInt,
int  theBinCountInt = 256,
bool  theIgnoreOutOfRangeFlag = true,
bool  theThoroughBandScanFlag = false 
) [slot]

void QgsRasterLayer::showStatusMessage ( const QString &  theMessage  )  [slot]

Definition at line 3610 of file qgsrasterlayer.cpp.

References QgsMapLayer::statusChanged().

Referenced by QgsRasterLayer().

void QgsRasterLayer::updateProgress ( int  theProgress,
int  theMax 
) [slot]

Propagate progress updates from GDAL up to the parent app.

Definition at line 3726 of file qgsrasterlayer.cpp.

References QgsMapLayer::drawingProgress().

void QgsRasterLayer::progressUpdate ( int  theValue  )  [signal]

Signal for notifying listeners of long running processes.

Referenced by showProgress().

bool QgsRasterLayer::readSymbology ( const QDomNode &  node,
QString &  errorMessage 
) [protected, virtual]

bool QgsRasterLayer::readXml ( QDomNode &  layer_node  )  [protected, virtual]

Reads layer specific state from project file Dom node.

Raster layer project file XML of form:.

  <maplayer type="raster" visible="1" showInOverviewFlag="1">
  <layername>Wynoochee_dem</layername>
  <datasource>/home/mcoletti/mnt/MCOLETTIF8F9/c/Toolkit_Course/Answers/Training_Data/wynoochee_dem.img</datasource>
  <zorder>0</zorder>
  <transparencyLevelInt>255</transparencyLevelInt>
  <rasterproperties>
  <mDrawingStyle>SingleBandGray</mDrawingStyle>
  <mInvertColor boolean="false"/>
  <mStandardDeviations>0</mStandardDeviations>
  <mRedBandName>Not Set</mRedBandName>
  <mGreenBandName>Not Set</mGreenBandName>
  <mBlueBandName>Not Set</mBlueBandName>
  <mGrayBandName>Undefined</mGrayBandName>
  </rasterproperties>
  </maplayer>
  

Note:
Called by QgsMapLayer::readXML().

Note:
Make sure to read the file first so stats etc are initialised properly!

Reimplemented from QgsMapLayer.

Definition at line 3960 of file qgsrasterlayer.cpp.

References QgsCoordinateReferenceSystem::authid(), QgsMapLayer::crs(), mProviderKey, readFile(), readSymbology(), setDataProvider(), QgsMapLayer::source(), QgsMapLayer::srs(), and QgsLogger::warning().

bool QgsRasterLayer::writeSymbology ( QDomNode &  layer_node,
QDomDocument &  doc,
QString &  errorMessage 
) const [protected, virtual]

bool QgsRasterLayer::writeXml ( QDomNode &  layer_node,
QDomDocument &  doc 
) [protected, virtual]

Write layer specific state to project file Dom node.

Reimplemented from QgsMapLayer.

Definition at line 4371 of file qgsrasterlayer.cpp.

References mProviderKey, QgsLogger::warning(), and writeSymbology().

void QgsRasterLayer::drawMultiBandColor ( QPainter *  theQPainter,
QgsRasterViewPort theRasterViewPort,
const QgsMapToPixel theQgsMapToPixel 
) [private]

void QgsRasterLayer::drawMultiBandSingleBandGray ( QPainter *  theQPainter,
QgsRasterViewPort theRasterViewPort,
const QgsMapToPixel theQgsMapToPixel,
int  theBandNoInt 
) [private]

Drawing routine for multiband image, rendered as a single band image in grayscale.

Definition at line 4565 of file qgsrasterlayer.cpp.

References drawSingleBandGray().

Referenced by draw().

void QgsRasterLayer::drawMultiBandSingleBandPseudoColor ( QPainter *  theQPainter,
QgsRasterViewPort theRasterViewPort,
const QgsMapToPixel theQgsMapToPixel,
int  theBandNoInt 
) [private]

Drawing routine for multiband image, rendered as a single band image in pseudocolor.

Definition at line 4572 of file qgsrasterlayer.cpp.

References drawSingleBandPseudoColor().

Referenced by draw().

void QgsRasterLayer::drawPalettedSingleBandColor ( QPainter *  theQPainter,
QgsRasterViewPort theRasterViewPort,
const QgsMapToPixel theQgsMapToPixel,
int  theBandNo 
) [private]

Drawing routine for single band with a color map.

This method is used to render a single band with a color map.

Parameters:
theQPainter pointer to the QPainter onto which the layer should be drawn.
theRasterViewPort pointer to the ViewPort struct containing dimensions of viewable area and subset area to be extracted from data file.
theQgsMapToPixel transformation coordinate to map canvas pixel
theBandNo band number

Definition at line 4586 of file qgsrasterlayer.cpp.

References QgsRasterTransparency::alphaValue(), QgsRasterViewPort::drawableAreaXDim, mGdalDataset, mGeoTransform, mInvertColor, mNoDataValue, mRasterShader, mRasterTransparency, QgsMapLayer::mTransparencyLevel, mValidNoDataValue, QgsRasterImageBuffer::nextScanLine(), QgsDebugMsg, readValue(), QgsRasterImageBuffer::reset(), QgsRasterShader::shade(), and TINY_VALUE.

Referenced by draw().

void QgsRasterLayer::drawPalettedSingleBandGray ( QPainter *  theQPainter,
QgsRasterViewPort theRasterViewPort,
const QgsMapToPixel theQgsMapToPixel,
int  theBandNo 
) [private]

Drawing routine for paletted image, rendered as a single band image in grayscale.

This method is used to render a paletted raster layer as a gray image.

Parameters:
theQPainter pointer to the QPainter onto which the layer should be drawn.
theRasterViewPort pointer to the ViewPort struct containing dimensions of viewable area and subset area to be extracted from data file.
theQgsMapToPixel transformation between map coordinates and canvas pixels
theBandNo band number

Definition at line 4666 of file qgsrasterlayer.cpp.

References QgsRasterTransparency::alphaValue(), QgsRasterViewPort::drawableAreaXDim, mGdalDataset, mGeoTransform, mInvertColor, mNoDataValue, mRasterShader, mRasterTransparency, QgsMapLayer::mTransparencyLevel, mValidNoDataValue, QgsRasterImageBuffer::nextScanLine(), QgsDebugMsg, readValue(), QgsRasterImageBuffer::reset(), QgsRasterShader::shade(), and TINY_VALUE.

Referenced by draw().

void QgsRasterLayer::drawPalettedSingleBandPseudoColor ( QPainter *  theQPainter,
QgsRasterViewPort theRasterViewPort,
const QgsMapToPixel theQgsMapToPixel,
int  theBandNo 
) [private]

Drawing routine for paletted image, rendered as a single band image in pseudocolor.

This method is used to render a paletted raster layer as a pseudocolor image.

Parameters:
theQPainter - pointer to the QPainter onto which the layer should be drawn.
theRasterViewPort - pointer to the ViewPort struct containing dimensions of viewable area and subset area to be extracted from data file.
theQgsMapToPixel transformation between map coordinates and canvas pixels
theBandNo band number gray.

Definition at line 4750 of file qgsrasterlayer.cpp.

References QgsRasterTransparency::alphaValue(), bandStatistics(), QgsRasterViewPort::drawableAreaXDim, QgsRasterBandStats::maximumValue, QgsRasterBandStats::mean, mGdalDataset, mGeoTransform, QgsRasterBandStats::minimumValue, mInvertColor, mNoDataValue, mRasterShader, mRasterTransparency, mStandardDeviations, QgsMapLayer::mTransparencyLevel, mValidNoDataValue, QgsRasterImageBuffer::nextScanLine(), QgsDebugMsg, readValue(), QgsRasterImageBuffer::reset(), QgsRasterShader::setMaximumValue(), QgsRasterShader::setMinimumValue(), QgsRasterShader::shade(), QgsRasterBandStats::stdDev, and TINY_VALUE.

Referenced by draw().

void QgsRasterLayer::drawPalettedMultiBandColor ( QPainter *  theQPainter,
QgsRasterViewPort theRasterViewPort,
const QgsMapToPixel theQgsMapToPixel,
int  theBandNo 
) [private]

Drawing routine for paletted multiband image.

This method is used to render a paletted raster layer as a color image -- currently not supported.

Parameters:
theQPainter pointer to the QPainter onto which the layer should be drawn.
theRasterViewPort pointer to the ViewPort struct containing dimensions of viewable area and subset area to be extracted from data file.
theQgsMapToPixel transformation coordinate to map canvas pixel
theBandNo pointer to the GDALRasterBand which should be rendered.
Note:
not supported at this time

Definition at line 4844 of file qgsrasterlayer.cpp.

References QgsDebugMsg.

Referenced by draw().

void QgsRasterLayer::drawSingleBandGray ( QPainter *  theQPainter,
QgsRasterViewPort theRasterViewPort,
const QgsMapToPixel theQgsMapToPixel,
int  theBandNoInt 
) [private]

void QgsRasterLayer::drawSingleBandPseudoColor ( QPainter *  theQPainter,
QgsRasterViewPort theRasterViewPort,
const QgsMapToPixel theQgsMapToPixel,
int  theBandNoInt 
) [private]

void QgsRasterLayer::closeDataset (  )  [private]

Close data set and release related data.

Definition at line 5023 of file qgsrasterlayer.cpp.

References mGdalBaseDataset, mGdalDataset, mHasPyramids, mPyramidList, mRasterStatsList, and QgsMapLayer::mValid.

Referenced by update().

QString QgsRasterLayer::generateBandName ( int  theBandNumber  )  [private]

helper function to create zero padded band names

Definition at line 5040 of file qgsrasterlayer.cpp.

References bandCount().

Referenced by identify(), readFile(), and validateBandName().

bool QgsRasterLayer::hasBand ( const QString &  theBandName  )  [private]

Find out whether a given band exists.

This method looks to see if a given band name exists.

Note:
This function is no longer really needed and about to be removed

Definition at line 5049 of file qgsrasterlayer.cpp.

References QgsLogger::debug(), mGdalDataset, QgsDebugMsg, and QgsDebugMsgLevel.

Referenced by paletteAsPixmap(), and readFile().

void QgsRasterLayer::paintImageToCanvas ( QPainter *  theQPainter,
QgsRasterViewPort theRasterViewPort,
const QgsMapToPixel theQgsMapToPixel,
QImage *  theImage 
) [private]

QString QgsRasterLayer::projectionWkt (  )  [private]

Query GDAL to find out the Wkt projection string for this layer.

Definition at line 5217 of file qgsrasterlayer.cpp.

References QgsCoordinateReferenceSystem::createFromWkt(), QgsCoordinateReferenceSystem::isValid(), and mGdalDataset.

Referenced by readFile().

void * QgsRasterLayer::readData ( GDALRasterBandH  gdalBand,
QgsRasterViewPort viewPort 
) [private]

bool QgsRasterLayer::readFile ( const QString &  fileName  )  [private]

Load the given raster file.

Definition at line 5291 of file qgsrasterlayer.cpp.

References bandName(), QgsRasterBandStats::bandName, QgsRasterBandStats::bandNumber, buildPyramidList(), ColorRampShader, colorTable(), QgsRasterBandStats::colorTable, QgsCoordinateReferenceSystem::createFromWkt(), generateBandName(), GrayOrUndefined, hasBand(), QgsRasterBandStats::histogramVector, QgsRasterTransparency::initializeTransparentPixelList(), QgsMapLayerRegistry::instance(), QgsColorRampShader::INTERPOLATED, QgsMapLayer::isValid(), QgsCoordinateReferenceSystem::isValid(), lastModified(), mBandCount, mBlueBandName, mContrastEnhancementList, QgsMapLayer::mCRS, mDrawingStyle, metadata(), mGdalBaseDataset, mGdalDataset, mGeoTransform, mGrayBandName, mGreenBandName, mHasPyramids, mHeight, mLastModified, QgsMapLayer::mLayerExtent, mNoDataValue, mRasterShader, mRasterStatsList, mRasterTransparency, mRasterType, mRedBandName, mTransparencyBandName, Multiband, MultiBandColor, QgsMapLayer::mValid, mValidNoDataValue, mWidth, QgsMapLayer::name(), Palette, PalettedColor, projectionWkt(), QgsDebugMsg, QgsRasterShader::rasterShaderFunction(), readColorTable(), registerGdalDrivers(), QgsColorRampShader::setColorRampItemList(), QgsColorRampShader::setColorRampType(), setColorShadingAlgorithm(), setContrastEnhancementAlgorithm(), QgsCoordinateReferenceSystem::setValidationHint(), QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), QgsRectangle::setYMaximum(), QgsRectangle::setYMinimum(), SingleBandGray, QgsRasterBandStats::statsGathered, subLayers(), TO8F, TRSTRING_NOT_SET, QgsCoordinateReferenceSystem::validate(), and QgsLogger::warning().

Referenced by QgsRasterLayer(), readXml(), and update().

double QgsRasterLayer::readValue ( void *  data,
GDALDataType  type,
int  index 
) [inline, private]

bool QgsRasterLayer::update (  )  [private]

Update the layer if it is outdated.

Definition at line 5580 of file qgsrasterlayer.cpp.

References closeDataset(), lastModified(), mLastModified, QgsDebugMsg, readFile(), QgsMapLayer::source(), and usesProvider().

Referenced by draw().

QString QgsRasterLayer::validateBandName ( const QString &  theBandName  )  [private]

Verify and transform band name for internal consistency.

Return 'Not Set' on any type of failure

Definition at line 5601 of file qgsrasterlayer.cpp.

References bandName(), generateBandName(), mRasterStatsList, QgsDebugMsg, QSTRING_NOT_SET, and TRSTRING_NOT_SET.

Referenced by setBlueBandName(), setGrayBandName(), setGreenBandName(), setRedBandName(), and setTransparentBandName().


Member Data Documentation

const QString QgsRasterLayer::QSTRING_NOT_SET [private]

Constant defining flag for XML and a constant that signals property not used.

Definition at line 796 of file qgsrasterlayer.h.

Referenced by validateBandName(), and writeSymbology().

const QString QgsRasterLayer::TRSTRING_NOT_SET [private]

Definition at line 797 of file qgsrasterlayer.h.

Referenced by draw(), QgsRasterLayer(), readFile(), validateBandName(), and writeSymbology().

The number of bands in the dataset.

Definition at line 800 of file qgsrasterlayer.h.

Referenced by bandCount(), QgsRasterLayer(), and readFile().

QString QgsRasterLayer::mBlueBandName [private]

The band to be associated with the color blue - usually 3.

Definition at line 803 of file qgsrasterlayer.h.

Referenced by draw(), drawMultiBandColor(), QgsRasterLayer(), readFile(), and setBlueBandName().

The raster shading algorithm being used.

Definition at line 806 of file qgsrasterlayer.h.

Referenced by colorShadingAlgorithmAsString(), legendAsPixmap(), QgsRasterLayer(), setColorShadingAlgorithm(), and setRasterShaderFunction().

The contrast enhancement algorithm being used.

Definition at line 809 of file qgsrasterlayer.h.

Referenced by contrastEnhancementAlgorithmAsString(), QgsRasterLayer(), and setContrastEnhancementAlgorithm().

Number of stddev to plot (0) to ignore.

Not applicable to all layer types

Definition at line 815 of file qgsrasterlayer.h.

Referenced by drawMultiBandColor(), drawPalettedSingleBandPseudoColor(), drawSingleBandGray(), and drawSingleBandPseudoColor().

[ data provider interface ] Pointer to data provider derived from the abstract base class QgsDataProvider

Definition at line 818 of file qgsrasterlayer.h.

Referenced by buildPyramidList(), dataProvider(), draw(), identify(), identifyAsHtml(), identifyAsText(), metadata(), QgsRasterLayer(), reload(), setDataProvider(), setLayerOrder(), setSubLayerVisibility(), subLayers(), and writeSymbology().

bool QgsRasterLayer::mEditable [private]

[ data provider interface ] Flag indicating whether the layer is in editing mode or not

Definition at line 823 of file qgsrasterlayer.h.

QString QgsRasterLayer::mError [private]

[ data provider interface ]The error message associated with the last error

Definition at line 826 of file qgsrasterlayer.h.

Referenced by draw(), and lastError().

QString QgsRasterLayer::mErrorCaption [private]

[ data provider interface ] The error caption associated with the last error

Definition at line 829 of file qgsrasterlayer.h.

Referenced by draw(), and lastErrorTitle().

GDALDatasetH QgsRasterLayer::mGdalBaseDataset [private]

Pointer to the gdaldataset.

Definition at line 832 of file qgsrasterlayer.h.

Referenced by buildPyramids(), closeDataset(), QgsRasterLayer(), readFile(), and ~QgsRasterLayer().

GDALDatasetH QgsRasterLayer::mGdalDataset [private]

double QgsRasterLayer::mGeoTransform[6] [private]

Values for mapping pixel to world coordinates.

Contents of this array are the same as the GDAL adfGeoTransform

Definition at line 838 of file qgsrasterlayer.h.

Referenced by draw(), drawMultiBandColor(), drawPalettedSingleBandColor(), drawPalettedSingleBandGray(), drawPalettedSingleBandPseudoColor(), drawSingleBandGray(), drawSingleBandPseudoColor(), metadata(), paintImageToCanvas(), QgsRasterLayer(), rasterUnitsPerPixel(), and readFile().

QString QgsRasterLayer::mGrayBandName [private]

The band to be associated with the grayscale only output - usually 1.

Definition at line 841 of file qgsrasterlayer.h.

Referenced by draw(), QgsRasterLayer(), readFile(), readSymbology(), and setGrayBandName().

Flag to indicate of the min max values are actual or estimates/user defined.

Definition at line 844 of file qgsrasterlayer.h.

Referenced by drawSingleBandGray(), and QgsRasterLayer().

QString QgsRasterLayer::mGreenBandName [private]

The band to be associated with the color green - usually 2.

Definition at line 847 of file qgsrasterlayer.h.

Referenced by draw(), drawMultiBandColor(), QgsRasterLayer(), readFile(), readSymbology(), and setGreenBandName().

Whether this raster has overviews / pyramids or not.

Definition at line 850 of file qgsrasterlayer.h.

Referenced by buildPyramids(), closeDataset(), legendAsPixmap(), QgsRasterLayer(), and readFile().

int QgsRasterLayer::mWidth [private]

Raster width.

Definition at line 853 of file qgsrasterlayer.h.

Referenced by buildPyramidList(), draw(), identify(), readFile(), thumbnailAsImage(), and thumbnailAsPixmap().

int QgsRasterLayer::mHeight [private]

Raster height.

Definition at line 856 of file qgsrasterlayer.h.

Referenced by bandStatistics(), buildPyramidList(), draw(), identify(), readFile(), thumbnailAsImage(), and thumbnailAsPixmap().

Flag indicating whether the color of pixels should be inverted or not.

Definition at line 859 of file qgsrasterlayer.h.

Referenced by drawMultiBandColor(), drawPalettedSingleBandColor(), drawPalettedSingleBandGray(), drawPalettedSingleBandPseudoColor(), drawSingleBandGray(), drawSingleBandPseudoColor(), and legendAsPixmap().

QDateTime QgsRasterLayer::mLastModified [private]

[ data provider interface ] Timestamp, the last modified time of the data source when the layer was created

Definition at line 862 of file qgsrasterlayer.h.

Referenced by readFile(), and update().

Definition at line 864 of file qgsrasterlayer.h.

Referenced by computeMinimumMaximumFromLastExtent(), draw(), and QgsRasterLayer().

QLibrary* QgsRasterLayer::mLib [private]

[ data provider interface ] pointer for loading the provider library

Definition at line 867 of file qgsrasterlayer.h.

Referenced by setDataProvider().

bool QgsRasterLayer::mModified [private]

[ data provider interface ] Flag indicating whether the layer has been modified since the last commit

Definition at line 870 of file qgsrasterlayer.h.

double QgsRasterLayer::mNoDataValue [private]

QString QgsRasterLayer::mProviderKey [private]

This list holds a series of RasterPyramid structs which store information for each potential pyramid level.

Definition at line 879 of file qgsrasterlayer.h.

Referenced by buildPyramidList(), and closeDataset().

A collection of stats - one for each band in the layer.

Definition at line 885 of file qgsrasterlayer.h.

Referenced by bandName(), bandNumber(), bandStatistics(), closeDataset(), colorTable(), hasStatistics(), readFile(), setNoDataValue(), and validateBandName().

Definition at line 890 of file qgsrasterlayer.h.

Referenced by bandStatistics(), QgsRasterLayer(), and readFile().

QString QgsRasterLayer::mRedBandName [private]

The band to be associated with the color red - usually 1.

Definition at line 893 of file qgsrasterlayer.h.

Referenced by draw(), drawMultiBandColor(), QgsRasterLayer(), readFile(), readSymbology(), and setRedBandName().

Flag to indicate of the min max values are actual or estimates/user defined.

Definition at line 896 of file qgsrasterlayer.h.

Referenced by drawMultiBandColor(), and QgsRasterLayer().

The band to be associated with transparency.

Definition at line 899 of file qgsrasterlayer.h.

Referenced by QgsRasterLayer(), readFile(), and setTransparentBandName().

Flag to indicate if the user entered custom min max values.

Definition at line 902 of file qgsrasterlayer.h.

Referenced by drawSingleBandGray(), and QgsRasterLayer().

Flag to indicate if the user entered custom min max values.

Definition at line 905 of file qgsrasterlayer.h.

Referenced by drawMultiBandColor(), and QgsRasterLayer().


The documentation for this class was generated from the following files:

Generated on Sat Feb 4 19:17:47 2012 for Quantum GIS API Documentation by  doxygen 1.5.6