#include <qgsrasterlayer.h>
Inheritance diagram for QgsRasterLayer:


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 MultiBandSingleGandGray -> 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 179 of file qgsrasterlayer.h.
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, 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< QgsRasterPyramid > | RasterPyramidList |
| A list containing one RasterPyramid struct per raster band in this raster layer. | |
| typedef QList< QgsRasterBandStats > | RasterStatsList |
| 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. | |
| QgsRasterTransparency * | rasterTransparency () |
| Returns a pointer to the transparency object. | |
| QgsRasterShader * | rasterShader () |
| 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. | |
| QgsContrastEnhancement * | contrastEnhancement (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. | |
| QgsRasterDataProvider * | dataProvider () |
| Returns the data provider. | |
| const QgsRasterDataProvider * | dataProvider () const |
| Returns the data provider in a const-correct manner. | |
| 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. | |
| 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 | 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 | 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 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. | |
| 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 |
| 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. | |
| QgsRasterDataProvider * | mDataProvider |
| [ data provider interface ] Pointer to data provider derived from the abstract base class QgsDataProvider | |
| DrawingStyle | mDrawingStyle |
| bool | mEditable |
| [ data provider interface ] Flag indicating wheter 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 | |
| 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. | |
| QgsRasterShader * | mRasterShader |
| 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. | |
| typedef QList<QgsContrastEnhancement> QgsRasterLayer::ContrastEnhancementList |
A list containing on ContrastEnhancement object per raster band in this raster layer.
Definition at line 256 of file qgsrasterlayer.h.
| typedef QList<QgsRasterPyramid> QgsRasterLayer::RasterPyramidList |
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 265 of file qgsrasterlayer.h.
| typedef QList<QgsRasterBandStats> QgsRasterLayer::RasterStatsList |
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 270 of file qgsrasterlayer.h.
This enumerator describes the types of shading that can be used.
Definition at line 222 of file qgsrasterlayer.h.
This enumerator describes the different kinds of drawing we can do.
Definition at line 232 of file qgsrasterlayer.h.
This enumerator describes the type of raster layer.
Reimplemented from QgsMapLayer.
Definition at line 248 of file qgsrasterlayer.h.
| QgsRasterLayer::QgsRasterLayer | ( | const QString & | path = QString::null, |
|
| const QString & | baseName = QString::null, |
|||
| bool | loadDefaultStyleFlag = true | |||
| ) |
This is the constructor for the RasterLayer class.
The main tasks carried out by the constructor are:
-Load the rasters default style (.qml) file if it exists
-Populate the RasterStatsVector with initial values for each band.
-Calculate the layer extents
-Determine whether the layer is gray, paletted or multiband.
-Assign sensible defaults for the red, green, blue and gray bands.
Definition at line 73 of file qgsrasterlayer.cpp.
References QgsMapLayer::loadDefaultStyle(), mGeoTransform, mGrayMinimumMaximumEstimated, mRasterShader, mRGBMinimumMaximumEstimated, mUserDefinedGrayMinimumMaximum, mUserDefinedRGBMinimumMaximum, readFile(), and QgsMapLayer::setLayerName().
| 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
| dummy | is just there to distinguish this function signature from the old non-provider one. |
Definition at line 132 of file qgsrasterlayer.cpp.
References mDataProvider, mGeoTransform, mRasterShader, QgsDebugMsg, setDataProvider(), showStatusMessage(), and QgsMapLayer::statusChanged().
| QgsRasterLayer::~QgsRasterLayer | ( | ) |
The destructor.
Definition at line 194 of file qgsrasterlayer.cpp.
References mGdalBaseDataset, mGdalDataset, and mProviderKey.
| 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 226 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.
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 387 of file qgsrasterlayer.cpp.
References registerGdalDrivers().
Referenced by isValidRasterFileName().
| bool QgsRasterLayer::isValidRasterFileName | ( | const QString & | theFileNameQString | ) | [static] |
| QDateTime QgsRasterLayer::lastModified | ( | const QString & | name | ) | [static] |
Return time stamp for given file name.
Definition at line 426 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 497 of file qgsrasterlayer.cpp.
Referenced by buildSupportedRasterFileFilter(), isValidRasterFileName(), and readFile().
| QString QgsRasterLayer::blueBandName | ( | ) | const [inline] |
Accessor for blue band name mapping.
Definition at line 304 of file qgsrasterlayer.h.
Referenced by writeSymbology().
| QgsRasterLayer::ColorShadingAlgorithm QgsRasterLayer::colorShadingAlgorithm | ( | ) | const [inline] |
Accessor for color shader algorithm.
Definition at line 307 of file qgsrasterlayer.h.
Referenced by writeSymbology().
| QgsContrastEnhancement::ContrastEnhancementAlgorithm QgsRasterLayer::contrastEnhancementAlgorithm | ( | ) | [inline] |
Accessor for contrast enhancement algorithm.
Definition at line 310 of file qgsrasterlayer.h.
Referenced by drawMultiBandColor(), and drawSingleBandGray().
| QString QgsRasterLayer::contrastEnhancementAlgorithmAsString | ( | ) | const |
Returns contrast enhancement algorithm as a string.
Definition at line 1243 of file qgsrasterlayer.cpp.
References QgsContrastEnhancement::ClipToMinimumMaximum, mContrastEnhancementAlgorithm, QgsContrastEnhancement::NoEnhancement, QgsContrastEnhancement::StretchAndClipToMinimumMaximum, QgsContrastEnhancement::StretchToMinimumMaximum, and QgsContrastEnhancement::UserDefinedEnhancement.
Referenced by writeSymbology().
| DrawingStyle QgsRasterLayer::drawingStyle | ( | ) | [inline] |
| QString QgsRasterLayer::grayBandName | ( | ) | const [inline] |
Accessor for gray band name mapping.
Definition at line 319 of file qgsrasterlayer.h.
Referenced by writeSymbology().
| QString QgsRasterLayer::greenBandName | ( | ) | const [inline] |
Accessor for green band name mapping.
Definition at line 322 of file qgsrasterlayer.h.
Referenced by writeSymbology().
| bool QgsRasterLayer::hasPyramids | ( | ) | [inline] |
| bool QgsRasterLayer::hasUserDefinedGrayMinimumMaximum | ( | ) | const [inline] |
Accessor for mUserDefinedGrayMinimumMaximum.
Definition at line 328 of file qgsrasterlayer.h.
Referenced by writeSymbology().
| bool QgsRasterLayer::hasUserDefinedRGBMinimumMaximum | ( | ) | const [inline] |
Accessor for mUserDefinedRGBMinimumMaximum.
Definition at line 331 of file qgsrasterlayer.h.
Referenced by writeSymbology().
| int QgsRasterLayer::height | ( | ) | [inline] |
Accessor that returns the height of the (unclipped) raster.
Definition at line 334 of file qgsrasterlayer.h.
| bool QgsRasterLayer::invertHistogram | ( | ) | const [inline] |
Accessor to find out whether the histogram should be inverted.
Definition at line 337 of file qgsrasterlayer.h.
Referenced by writeSymbology().
| bool QgsRasterLayer::isNoDataValueValid | ( | ) | const [inline] |
| bool QgsRasterLayer::isGrayMinimumMaximumEstimated | ( | ) | const [inline] |
Accessor for mGrayMinimumMaximumEstimated.
Definition at line 343 of file qgsrasterlayer.h.
Referenced by writeSymbology().
| bool QgsRasterLayer::isRGBMinimumMaximumEstimated | ( | ) | const [inline] |
Accessor for mRGBMinimumMaximumEstimated.
Definition at line 346 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 349 of file qgsrasterlayer.h.
| QgsRasterTransparency* QgsRasterLayer::rasterTransparency | ( | ) | [inline] |
| QgsRasterShader* QgsRasterLayer::rasterShader | ( | ) | [inline] |
| LayerType QgsRasterLayer::rasterType | ( | ) | [inline] |
Accessor for raster layer type (which is a read only property).
Definition at line 358 of file qgsrasterlayer.h.
| QString QgsRasterLayer::redBandName | ( | ) | const [inline] |
Accessor for red band name (allows alternate mappings e.g.
map blue as red color)
Definition at line 361 of file qgsrasterlayer.h.
Referenced by writeSymbology().
| void QgsRasterLayer::setDataProvider | ( | const QString & | provider, | |
| const QStringList & | layers, | |||
| const QStringList & | styles, | |||
| const QString & | format, | |||
| const QString & | crs | |||
| ) |
[ data provider interface ] Set the data provider
Definition at line 3031 of file qgsrasterlayer.cpp.
References cast_to_fptr(), QgsCoordinateReferenceSystem::createFromOgcWmsCrs(), QgsProviderRegistry::instance(), QgsProviderRegistry::library(), QgsMapLayer::mCRS, mDataProvider, QgsMapLayer::mDataSource, mDrawingStyle, QgsMapLayer::mLayerExtent, mLib, mProviderKey, MultiBandColor, QgsMapLayer::mValid, QgsMapLayer::name(), QgsDebugMsg, QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), QgsRectangle::setYMaximum(), QgsRectangle::setYMinimum(), QgsRectangle::toString(), QgsLogger::warning(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
Referenced by QgsRasterLayer(), and readXml().
| void QgsRasterLayer::setDrawingStyle | ( | const DrawingStyle & | theDrawingStyle | ) | [inline] |
Mutator for drawing style.
Definition at line 371 of file qgsrasterlayer.h.
Referenced by readSymbology().
| void QgsRasterLayer::setGrayMinimumMaximumEstimated | ( | bool | theBool | ) | [inline] |
Mutator for mGrayMinimumMaximumEstimated.
Definition at line 374 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 377 of file qgsrasterlayer.h.
Referenced by readSymbology().
| void QgsRasterLayer::setRGBMinimumMaximumEstimated | ( | bool | theBool | ) | [inline] |
Mutator for mRGBMinimumMaximumEstimated.
Definition at line 380 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 383 of file qgsrasterlayer.h.
Referenced by readSymbology().
| void QgsRasterLayer::setUserDefinedGrayMinimumMaximum | ( | bool | theBool | ) | [inline] |
Mutator for mUserDefinedGrayMinimumMaximum.
Definition at line 386 of file qgsrasterlayer.h.
Referenced by readSymbology().
| void QgsRasterLayer::setUserDefinedRGBMinimumMaximum | ( | bool | theBool | ) | [inline] |
Mutator for mUserDefinedRGBMinimumMaximum.
Definition at line 389 of file qgsrasterlayer.h.
Referenced by readSymbology().
| double QgsRasterLayer::standardDeviations | ( | ) | const [inline] |
Accessor to find out how many standard deviations are being plotted.
Definition at line 392 of file qgsrasterlayer.h.
Referenced by writeSymbology().
| QString QgsRasterLayer::transparentBandName | ( | ) | const [inline] |
| bool QgsRasterLayer::usesProvider | ( | ) |
[ data provider interface ] Does this layer use a provider for setting/retrieving data?
Definition at line 5254 of file qgsrasterlayer.cpp.
References mProviderKey.
| int QgsRasterLayer::width | ( | ) | [inline] |
Accessor that returns the width of the (unclipped) raster.
Definition at line 401 of file qgsrasterlayer.h.
| unsigned int QgsRasterLayer::bandCount | ( | ) |
Get the number of bands in this layer.
Definition at line 614 of file qgsrasterlayer.cpp.
References mRasterStatsList.
Referenced by computeMinimumMaximumEstimates(), contrastEnhancement(), maximumValue(), metadata(), minimumValue(), setMaximumValue(), and setMinimumValue().
| const QString QgsRasterLayer::bandName | ( | int | theBandNoInt | ) |
Get the name of a band given its number.
Definition at line 619 of file qgsrasterlayer.cpp.
References mRasterStatsList, and QgsDebugMsg.
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 633 of file qgsrasterlayer.cpp.
References mRasterStatsList, and QgsDebugMsg.
Referenced by computeMinimumMaximumEstimates(), draw(), drawMultiBandColor(), maximumValue(), minimumValue(), setMaximumValue(), and setMinimumValue().
| const QgsRasterBandStats QgsRasterLayer::bandStatistics | ( | int | theBandNo | ) |
Get RasterBandStats for a band given its number (read only).
Populates rasterStatsMemArray. Calculates:
RasterBandStats
Definition at line 675 of file qgsrasterlayer.cpp.
References QgsRasterBandStats::bandNumber, QgsLogger::debug(), QgsMapLayer::drawingProgress(), QgsRasterBandStats::elementCount, QgsRasterBandStats::maximumValue, mGdalDataset, QgsRasterBandStats::minimumValue, mNoDataValue, mRasterStatsList, mRasterType, mValidNoDataValue, QgsMapLayer::name(), Palette, QgsDebugMsg, readValue(), QgsRasterBandStats::statsGathered, QgsMapLayer::statusChanged(), and QgsRasterBandStats::sum.
Referenced by bandStatistics(), drawMultiBandColor(), drawPalettedSingleBandPseudoColor(), drawSingleBandGray(), drawSingleBandPseudoColor(), metadata(), and populateHistogram().
| const QgsRasterBandStats QgsRasterLayer::bandStatistics | ( | const QString & | ) |
Get RasterBandStats for a band given its name (read only).
Definition at line 926 of file qgsrasterlayer.cpp.
References 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 1104 of file qgsrasterlayer.cpp.
References QgsLogger::debug(), QgsRasterPyramid::exists, QgsRasterPyramid::level, 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 1182 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.
| theMinMax | Pointer to a double[2] which hold the estimated min max |
Definition at line 1209 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.
| theMinMax | Pointer to a double[2] which hold the estimated min max |
Definition at line 1224 of file qgsrasterlayer.cpp.
References bandNumber(), and computeMinimumMaximumEstimates().
| QgsContrastEnhancement * QgsRasterLayer::contrastEnhancement | ( | unsigned int | theBand | ) |
Get a pointer to the contrast enhancement for the selected band.
Definition at line 1233 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
Implements QgsMapLayer.
Definition at line 1271 of file qgsrasterlayer.cpp.
References QgsMapLayer::type().
| QList< QgsColorRampShader::ColorRampItem > * QgsRasterLayer::colorTable | ( | int | theBandNo | ) |
Get a pointer to the color table.
Definition at line 1285 of file qgsrasterlayer.cpp.
References mRasterStatsList.
Referenced by readFile().
| QgsRasterDataProvider * QgsRasterLayer::dataProvider | ( | ) |
Returns the data provider.
directly using GDAL)
Definition at line 1293 of file qgsrasterlayer.cpp.
References mDataProvider.
Referenced by QgsComposerMap::containsWMSLayer().
| const QgsRasterDataProvider * QgsRasterLayer::dataProvider | ( | ) | const |
Returns the data provider in a const-correct manner.
directly using GDAL)
Definition at line 1301 of file qgsrasterlayer.cpp.
References mDataProvider.
| bool QgsRasterLayer::draw | ( | QgsRenderContext & | rendererContext | ) | [virtual] |
This is called when the view on the raster layer needs to be redrawn.
Reimplemented from QgsMapLayer.
Definition at line 1306 of file qgsrasterlayer.cpp.
References QgsRasterDataProvider::draw(), QgsRenderContext::extent(), QgsRectangle::intersect(), QgsRectangle::isEmpty(), QgsRasterDataProvider::lastError(), QgsRasterDataProvider::lastErrorTitle(), QgsRenderContext::mapToPixel(), QgsMapToPixel::mapUnitsPerPixel(), mBlueBandName, mDataProvider, mError, mErrorCaption, mGeoTransform, mGrayBandName, mGreenBandName, mHeight, QgsMapLayer::mLayerExtent, mProviderKey, mRedBandName, QgsMapLayer::mTransparencyLevel, mWidth, QgsRenderContext::painter(), QgsDebugMsg, QgsMapLayer::statusChanged(), QgsRectangle::toString(), QgsMapToPixel::transform(), update(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
Referenced by thumbnailAsPixmap().
| void QgsRasterLayer::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.
Definition at line 1551 of file qgsrasterlayer.cpp.
References bandNumber(), drawMultiBandColor(), drawMultiBandSingleBandGray(), drawMultiBandSingleBandPseudoColor(), drawPalettedMultiBandColor(), drawPalettedSingleBandColor(), drawPalettedSingleBandGray(), drawPalettedSingleBandPseudoColor(), drawSingleBandGray(), drawSingleBandPseudoColor(), mBlueBandName, mDrawingStyle, mGrayBandName, mGreenBandName, mRedBandName, MultiBandColor, MultiBandSingleBandPseudoColor, MultiBandSingleGandGray, PalettedColor, PalettedMultiBandColor, PalettedSingleBandGray, PalettedSingleBandPseudoColor, QgsDebugMsg, SingleBandGray, SingleBandPseudoColor, and TRSTRING_NOT_SET.
| QString QgsRasterLayer::drawingStyleAsString | ( | ) | const |
Returns a string representation of drawing style.
Implementaed mainly for serialisation / deserialisation of settings to xml. NOTE: May be deprecated in the future!. DrawingStyle drawingStyle() instead.
Definition at line 1699 of file qgsrasterlayer.cpp.
References mDrawingStyle, MultiBandColor, MultiBandSingleBandPseudoColor, MultiBandSingleGandGray, 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.
Implements QgsMapLayer.
Definition at line 1742 of file qgsrasterlayer.cpp.
References QgsMapLayer::type().
| bool QgsRasterLayer::hasStatistics | ( | int | theBandNo | ) |
Check whether a given band number has stats associated with it.
Definition at line 1756 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.
| theResults | QMap to hold the pixel values at thePoint for each layer in the raster file |
Definition at line 1774 of file qgsrasterlayer.cpp.
References QgsLogger::debug(), mGdalDataset, mHeight, QgsMapLayer::mLayerExtent, mNoDataValue, mProviderKey, mValidNoDataValue, mWidth, QgsDebugMsg, readValue(), 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.
| thePoint | an image pixel coordinate in the last requested extent of layer. |
Definition at line 1851 of file qgsrasterlayer.cpp.
References QgsRasterDataProvider::identifyAsText(), mDataProvider, and mProviderKey.
| bool QgsRasterLayer::isEditable | ( | ) | const [virtual] |
Currently returns always false.
Implements QgsMapLayer.
Definition at line 1866 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 1871 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 1876 of file qgsrasterlayer.cpp.
References mErrorCaption.
| QPixmap QgsRasterLayer::legendAsPixmap | ( | ) |
Get a legend image for this layer.
Definition at line 1885 of file qgsrasterlayer.cpp.
Referenced by QgsLegendModel::addRasterLayerItem(), and QgsLegendModel::updateRasterClassificationItem().
| QPixmap QgsRasterLayer::legendAsPixmap | ( | bool | theWithNameFlag | ) |
Overloaded version of above function that can print layer name onto legend.
Definition at line 1894 of file qgsrasterlayer.cpp.
References QgsApplication::activeThemePath(), drawingStyleAsString(), FreakOutShader, mColorShadingAlgorithm, mDrawingStyle, mGdalDataset, mHasPyramids, mInvertColor, mProviderKey, MultiBandColor, MultiBandSingleBandPseudoColor, MultiBandSingleGandGray, QgsMapLayer::name(), 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.
Definition at line 2165 of file qgsrasterlayer.cpp.
References FreakOutShader, mColorShadingAlgorithm, mDrawingStyle, mGdalDataset, mInvertColor, MultiBandColor, MultiBandSingleBandPseudoColor, MultiBandSingleGandGray, QgsMapLayer::name(), PalettedMultiBandColor, PalettedSingleBandGray, PalettedSingleBandPseudoColor, QgsDebugMsg, SingleBandGray, and SingleBandPseudoColor.
| double QgsRasterLayer::maximumValue | ( | unsigned int | theBand | ) |
Accessor for maximum value user for contrast enhancement.
Definition at line 2396 of file qgsrasterlayer.cpp.
References bandCount(), and mContrastEnhancementList.
Referenced by maximumValue().
| double QgsRasterLayer::maximumValue | ( | QString | theBand | ) |
Accessor for maximum value user for contrast enhancement.
Definition at line 2410 of file qgsrasterlayer.cpp.
References bandNumber(), and maximumValue().
| QString QgsRasterLayer::metadata | ( | ) |
Obtain GDAL Metadata for this layer.
Definition at line 2421 of file qgsrasterlayer.cpp.
References bandCount(), bandName(), bandStatistics(), cStringList2Q_(), QgsDataProvider::description(), QgsRasterBandStats::elementCount, hasStatistics(), makeTableCells_(), QgsRasterBandStats::maximumValue, QgsMapLayer::mCRS, mDataProvider, QgsRasterBandStats::mean, QgsRasterDataProvider::metadata(), mGdalDataset, mGeoTransform, QgsRasterBandStats::minimumValue, mNoDataValue, mProviderKey, mValidNoDataValue, QgsDebugMsg, QgsRasterBandStats::range, QgsRasterBandStats::stdDev, QgsRasterBandStats::sum, QgsRasterBandStats::sumOfSquares, and QgsCoordinateReferenceSystem::toProj4().
Referenced by readFile().
| double QgsRasterLayer::minimumValue | ( | unsigned int | theBand | ) |
Accessor for minimum value user for contrast enhancement.
Definition at line 2752 of file qgsrasterlayer.cpp.
References bandCount(), and mContrastEnhancementList.
Referenced by minimumValue().
| double QgsRasterLayer::minimumValue | ( | QString | theBand | ) |
Accessor for minimum value user for contrast enhancement.
Definition at line 2766 of file qgsrasterlayer.cpp.
References bandNumber(), and minimumValue().
| QPixmap QgsRasterLayer::paletteAsPixmap | ( | int | theBand = 1 |
) |
Get an 100x100 pixmap of the color palette.
If the layer has no palette a white pixmap will be returned
Definition at line 2775 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 2886 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)
Definition at line 2901 of file qgsrasterlayer.cpp.
References mGeoTransform.
| bool QgsRasterLayer::readColorTable | ( | int | theBandNumber, | |
| QList< QgsColorRampShader::ColorRampItem > * | theList | |||
| ) |
Read color table from GDAL raster band.
| theList | a pointer the object that will hold the color table |
Definition at line 2917 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 3001 of file qgsrasterlayer.cpp.
References mGdalDataset, mNoDataValue, mValidNoDataValue, and setNoDataValue().
| void QgsRasterLayer::setBlueBandName | ( | const QString & | theBandName | ) |
Mutator for blue band name mapping.
Definition at line 3023 of file qgsrasterlayer.cpp.
References mBlueBandName, and validateBandName().
Referenced by readSymbology().
| void QgsRasterLayer::setColorShadingAlgorithm | ( | QgsRasterLayer::ColorShadingAlgorithm | theShaderAlgorithm | ) |
Mutator for color shader algorithm.
Definition at line 3143 of file qgsrasterlayer.cpp.
References ColorRampShader, FreakOutShader, mColorShadingAlgorithm, mRasterShader, PseudoColorShader, QgsDebugMsg, QgsRasterShader::setRasterShaderFunction(), and UserDefinedShader.
Referenced by readFile(), readSymbology(), and setColorShadingAlgorithm().
| void QgsRasterLayer::setColorShadingAlgorithm | ( | QString | theShaderAlgorithm | ) |
Mutator for color shader algorithm.
Definition at line 3177 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 3193 of file qgsrasterlayer.cpp.
References mContrastEnhancementAlgorithm, and mContrastEnhancementList.
Referenced by readFile(), readSymbology(), and setContrastEnhancementAlgorithm().
| void QgsRasterLayer::setContrastEnhancementAlgorithm | ( | QString | theAlgorithm, | |
| bool | theGenerateLookupTableFlag = true | |||
| ) |
Mutator for contrast enhancement algorithm.
Definition at line 3204 of file qgsrasterlayer.cpp.
References QgsContrastEnhancement::ClipToMinimumMaximum, QgsContrastEnhancement::NoEnhancement, QgsDebugMsg, setContrastEnhancementAlgorithm(), QgsContrastEnhancement::StretchAndClipToMinimumMaximum, QgsContrastEnhancement::StretchToMinimumMaximum, and QgsContrastEnhancement::UserDefinedEnhancement.
| void QgsRasterLayer::setContrastEnhancementFunction | ( | QgsContrastEnhancementFunction * | theFunction | ) |
Mutator for contrast enhancement function.
Definition at line 3234 of file qgsrasterlayer.cpp.
References mContrastEnhancementList.
| void QgsRasterLayer::setDrawingStyle | ( | const QString & | theDrawingStyleQString | ) |
Overloaded version of the above function for convenience when restoring from xml.
Definition at line 3252 of file qgsrasterlayer.cpp.
References mDrawingStyle, MultiBandColor, MultiBandSingleBandPseudoColor, MultiBandSingleGandGray, PalettedColor, PalettedMultiBandColor, PalettedSingleBandGray, PalettedSingleBandPseudoColor, SingleBandGray, SingleBandPseudoColor, and UndefinedDrawingStyle.
| void QgsRasterLayer::setGrayBandName | ( | const QString & | theBandName | ) |
Mutator for gray band name mapping.
Definition at line 3296 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 3301 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 3318 of file qgsrasterlayer.cpp.
References bandCount(), and mContrastEnhancementList.
Referenced by drawMultiBandColor(), drawSingleBandGray(), readSymbology(), and setMaximumValue().
| void QgsRasterLayer::setMaximumValue | ( | QString | theBand, | |
| double | theValue, | |||
| bool | theGenerateLookupTableFlag = true | |||
| ) |
Mutator for setting the maximum value for contrast enhancement.
Definition at line 3326 of file qgsrasterlayer.cpp.
References bandNumber(), and setMaximumValue().
| void QgsRasterLayer::setMinimumValue | ( | unsigned int | theBand, | |
| double | theValue, | |||
| bool | theGenerateLookupTableFlag = true | |||
| ) |
Mutator for setting the minimum value for contrast enhancement.
Definition at line 3334 of file qgsrasterlayer.cpp.
References bandCount(), and mContrastEnhancementList.
Referenced by drawMultiBandColor(), drawSingleBandGray(), readSymbology(), and setMinimumValue().
| void QgsRasterLayer::setMinimumValue | ( | QString | theBand, | |
| double | theValue, | |||
| bool | theGenerateLookupTableFlag = true | |||
| ) |
Mutator for setting the minimum value for contrast enhancement.
Definition at line 3342 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 3351 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.
Definition at line 3367 of file qgsrasterlayer.cpp.
References mColorShadingAlgorithm, mRasterShader, QgsRasterShader::setRasterShaderFunction(), 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 3382 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 3399 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 3404 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 3419 of file qgsrasterlayer.cpp.
References mDataProvider, and QgsDataProvider::subLayers().
Referenced by writeSymbology().
| void QgsRasterLayer::thumbnailAsPixmap | ( | QPixmap * | theQPixmap | ) |
Draws a thumbnail of the rasterlayer into the supplied pixmap pointer.
Definition at line 3433 of file qgsrasterlayer.cpp.
References draw(), mHeight, mProviderKey, and mWidth.
| void QgsRasterLayer::triggerRepaint | ( | ) |
Emit a signal asking for a repaint.
(inherited from maplayer)
Definition at line 3466 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 3306 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 3388 of file qgsrasterlayer.cpp.
References mDataProvider, QgsDebugMsg, and QgsDataProvider::setSubLayerVisibility().
| QString QgsRasterLayer::buildPyramids | ( | const RasterPyramidList & | , | |
| const QString & | theResamplingMethod = "NEAREST", |
|||
| bool | theTryInternalFlag = false | |||
| ) | [slot] |
Create GDAL pyramid overviews.
Definition at line 954 of file qgsrasterlayer.cpp.
References QgsLogger::debug(), QgsMapLayer::drawingProgress(), QgsMapLayer::mDataSource, mGdalBaseDataset, mGdalDataset, mHasPyramids, progressCallback(), QgsDebugMsg, and QgsLogger::warning().
| void QgsRasterLayer::populateHistogram | ( | int | theBandNoInt, | |
| int | theBinCountInt = 256, |
|||
| bool | theIgnoreOutOfRangeFlag = true, |
|||
| bool | theThoroughBandScanFlag = false | |||
| ) | [slot] |
Populate the histogram vector for a given band.
Definition at line 2836 of file qgsrasterlayer.cpp.
References bandStatistics(), QgsRasterBandStats::histogramVector, QgsRasterBandStats::isHistogramEstimated, QgsRasterBandStats::isHistogramOutOfRange, QgsRasterBandStats::maximumValue, mGdalDataset, QgsRasterBandStats::minimumValue, progressCallback(), and QgsDebugMsg.
| void QgsRasterLayer::showStatusMessage | ( | const QString & | theMessage | ) | [slot] |
Definition at line 3410 of file qgsrasterlayer.cpp.
References QgsMapLayer::statusChanged().
Referenced by QgsRasterLayer().
| void QgsRasterLayer::updateProgress | ( | int | , | |
| int | ||||
| ) | [slot] |
Propagate progress updates from GDAL up to the parent app.
Definition at line 3471 of file qgsrasterlayer.cpp.
References QgsMapLayer::drawingProgress().
| void QgsRasterLayer::progressUpdate | ( | int | theValue | ) | [signal] |
| bool QgsRasterLayer::readSymbology | ( | const QDomNode & | node, | |
| QString & | errorMessage | |||
| ) | [protected, virtual] |
Read the symbology for the current layer from the Dom node supplied.
Implements QgsMapLayer.
Definition at line 3490 of file qgsrasterlayer.cpp.
References drawingStyleAsString(), mGrayBandName, mGreenBandName, mRasterShader, mRasterTransparency, mRedBandName, mValidNoDataValue, QgsDebugMsg, QgsRasterShader::rasterShaderFunction(), setBlueBandName(), setColorShadingAlgorithm(), setContrastEnhancementAlgorithm(), setDrawingStyle(), setGrayBandName(), setGrayMinimumMaximumEstimated(), setGreenBandName(), setInvertHistogram(), setMaximumValue(), setMinimumValue(), setNoDataValue(), setRedBandName(), setRGBMinimumMaximumEstimated(), setStandardDeviations(), QgsRasterTransparency::setTransparentSingleValuePixelList(), QgsRasterTransparency::setTransparentThreeValuePixelList(), setUserDefinedGrayMinimumMaximum(), and setUserDefinedRGBMinimumMaximum().
Referenced by readXml().
| bool QgsRasterLayer::readXml | ( | QDomNode & | layer_node | ) | [protected, virtual] |
Reads layer specific state from project file Dom node.
<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>
Reimplemented from QgsMapLayer.
Definition at line 3703 of file qgsrasterlayer.cpp.
References mProviderKey, readFile(), readSymbology(), setDataProvider(), QgsMapLayer::source(), QgsMapLayer::srs(), and QgsLogger::warning().
| bool QgsRasterLayer::writeSymbology | ( | QDomNode & | , | |
| QDomDocument & | doc, | |||
| QString & | errorMessage | |||
| ) | const [protected, virtual] |
Write the symbology for the layer into the docment provided.
Implements QgsMapLayer.
Definition at line 3782 of file qgsrasterlayer.cpp.
References blueBandName(), ColorRampShader, colorShadingAlgorithm(), colorShadingAlgorithmAsString(), contrastEnhancementAlgorithmAsString(), drawingStyleAsString(), grayBandName(), greenBandName(), hasUserDefinedGrayMinimumMaximum(), hasUserDefinedRGBMinimumMaximum(), QgsRasterDataProvider::imageEncoding(), invertHistogram(), isGrayMinimumMaximumEstimated(), isRGBMinimumMaximumEstimated(), mContrastEnhancementList, mDataProvider, mNoDataValue, mProviderKey, mRasterShader, mRasterTransparency, mValidNoDataValue, QgsDebugMsg, QSTRING_NOT_SET, QgsRasterShader::rasterShaderFunction(), redBandName(), standardDeviations(), subLayers(), QgsDataProvider::subLayerStyles(), QgsRasterTransparency::transparentSingleValuePixelList(), QgsRasterTransparency::transparentThreeValuePixelList(), and TRSTRING_NOT_SET.
Referenced by writeXml().
| 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 4114 of file qgsrasterlayer.cpp.
References mProviderKey, QgsLogger::warning(), and writeSymbology().
| void QgsRasterLayer::drawMultiBandColor | ( | QPainter * | theQPainter, | |
| QgsRasterViewPort * | theRasterViewPort, | |||
| const QgsMapToPixel * | theQgsMapToPixel | |||
| ) | [private] |
Drawing routine for multiband image.
Definition at line 4149 of file qgsrasterlayer.cpp.
References QgsRasterTransparency::alphaValue(), bandNumber(), bandStatistics(), contrastEnhancement(), contrastEnhancementAlgorithm(), QgsRasterViewPort::drawableAreaXDim, QgsRasterViewPort::drawableAreaYDim, QgsContrastEnhancement::enhanceContrast(), QgsContrastEnhancement::isValueInDisplayableRange(), mBlueBandName, QgsRasterBandStats::mean, mGdalDataset, mGreenBandName, mInvertColor, mNoDataValue, mRasterTransparency, mRedBandName, mRGBMinimumMaximumEstimated, mStandardDeviations, QgsMapLayer::mTransparencyLevel, mUserDefinedRGBMinimumMaximum, mValidNoDataValue, QgsContrastEnhancement::NoEnhancement, paintImageToCanvas(), QgsDebugMsg, readData(), readValue(), setMaximumValue(), setMinimumValue(), and QgsRasterBandStats::stdDev.
Referenced by draw().
| 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 4321 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 4328 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.
| 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. | |
| theGdalBand | - pointer to the GDALRasterBand which should be rendered. |
Definition at line 4341 of file qgsrasterlayer.cpp.
References QgsRasterTransparency::alphaValue(), QgsRasterViewPort::drawableAreaXDim, QgsRasterViewPort::drawableAreaYDim, mGdalDataset, mInvertColor, mNoDataValue, mRasterShader, mRasterTransparency, QgsMapLayer::mTransparencyLevel, mValidNoDataValue, paintImageToCanvas(), QgsDebugMsg, readData(), readValue(), and QgsRasterShader::shade().
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.
| 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. | |
| theGdalBand | - pointer to the GDALRasterBand which should be rendered. |
Definition at line 4425 of file qgsrasterlayer.cpp.
References QgsRasterTransparency::alphaValue(), QgsRasterViewPort::drawableAreaXDim, QgsRasterViewPort::drawableAreaYDim, mGdalDataset, mInvertColor, mNoDataValue, mRasterShader, mRasterTransparency, QgsMapLayer::mTransparencyLevel, mValidNoDataValue, paintImageToCanvas(), QgsDebugMsg, readData(), readValue(), and QgsRasterShader::shade().
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.
| 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. | |
| theGdalBand | - pointer to the GDALRasterBand which should be rendered. gray. |
Definition at line 4513 of file qgsrasterlayer.cpp.
References QgsRasterTransparency::alphaValue(), bandStatistics(), QgsRasterViewPort::drawableAreaXDim, QgsRasterViewPort::drawableAreaYDim, QgsRasterBandStats::maximumValue, QgsRasterBandStats::mean, mGdalDataset, QgsRasterBandStats::minimumValue, mInvertColor, mNoDataValue, mRasterShader, mRasterTransparency, mStandardDeviations, QgsMapLayer::mTransparencyLevel, mValidNoDataValue, paintImageToCanvas(), QgsDebugMsg, readData(), readValue(), QgsRasterShader::setMaximumValue(), QgsRasterShader::setMinimumValue(), QgsRasterShader::shade(), and QgsRasterBandStats::stdDev.
Referenced by draw().
| void QgsRasterLayer::drawPalettedMultiBandColor | ( | QPainter * | theQPainter, | |
| QgsRasterViewPort * | theRasterViewPort, | |||
| const QgsMapToPixel * | theQgsMapToPixel, | |||
| int | theBandNo | |||
| ) | [private] |
Drawing routine for paletted multiband image.
| 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. | |
| theGdalBand | - pointer to the GDALRasterBand which should be rendered. |
Definition at line 4615 of file qgsrasterlayer.cpp.
References QgsDebugMsg.
Referenced by draw().
| void QgsRasterLayer::drawSingleBandGray | ( | QPainter * | theQPainter, | |
| QgsRasterViewPort * | theRasterViewPort, | |||
| const QgsMapToPixel * | theQgsMapToPixel, | |||
| int | theBandNoInt | |||
| ) | [private] |
Drawing routine for single band grayscale image.
Definition at line 4621 of file qgsrasterlayer.cpp.
References QgsRasterTransparency::alphaValue(), bandStatistics(), contrastEnhancement(), contrastEnhancementAlgorithm(), QgsRasterViewPort::drawableAreaXDim, QgsRasterViewPort::drawableAreaYDim, QgsContrastEnhancement::enhanceContrast(), QgsContrastEnhancement::isValueInDisplayableRange(), QgsRasterBandStats::mean, mGdalDataset, mGrayMinimumMaximumEstimated, mInvertColor, mNoDataValue, mRasterTransparency, mStandardDeviations, QgsMapLayer::mTransparencyLevel, mUserDefinedGrayMinimumMaximum, mValidNoDataValue, QgsContrastEnhancement::NoEnhancement, paintImageToCanvas(), QgsDebugMsg, readData(), readValue(), setMaximumValue(), setMinimumValue(), and QgsRasterBandStats::stdDev.
Referenced by draw(), and drawMultiBandSingleBandGray().
| void QgsRasterLayer::drawSingleBandPseudoColor | ( | QPainter * | theQPainter, | |
| QgsRasterViewPort * | theRasterViewPort, | |||
| const QgsMapToPixel * | theQgsMapToPixel, | |||
| int | theBandNoInt | |||
| ) | [private] |
Drawing routine for single band grayscale image, rendered in pseudocolor.
Definition at line 4718 of file qgsrasterlayer.cpp.
References QgsRasterTransparency::alphaValue(), bandStatistics(), QgsRasterViewPort::drawableAreaXDim, QgsRasterViewPort::drawableAreaYDim, QgsRasterBandStats::maximumValue, QgsRasterBandStats::mean, mGdalDataset, QgsRasterBandStats::minimumValue, mInvertColor, mNoDataValue, mRasterShader, mRasterTransparency, mStandardDeviations, QgsMapLayer::mTransparencyLevel, mValidNoDataValue, paintImageToCanvas(), QgsDebugMsg, readData(), readValue(), QgsRasterShader::setMaximumValue(), QgsRasterShader::setMinimumValue(), QgsRasterShader::shade(), and QgsRasterBandStats::stdDev.
Referenced by draw(), and drawMultiBandSingleBandPseudoColor().
| void QgsRasterLayer::closeDataset | ( | ) | [private] |
Close data set and release related data.
Definition at line 4816 of file qgsrasterlayer.cpp.
References mGdalBaseDataset, mGdalDataset, mHasPyramids, mPyramidList, mRasterStatsList, and QgsMapLayer::mValid.
Referenced by update().
| bool QgsRasterLayer::hasBand | ( | const QString & | theBandName | ) | [private] |
Find out whether a given band exists.
Definition at line 4837 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] |
Places the rendered image onto the canvas.
Definition at line 4864 of file qgsrasterlayer.cpp.
References QgsMapToPixel::mapUnitsPerPixel(), mGeoTransform, QgsDebugMsg, QgsRasterViewPort::rectXOffset, QgsRasterViewPort::rectXOffsetFloat, QgsRasterViewPort::rectYOffset, QgsRasterViewPort::rectYOffsetFloat, QgsRasterViewPort::topLeftPoint, QgsPoint::x(), and QgsPoint::y().
Referenced by drawMultiBandColor(), drawPalettedSingleBandColor(), drawPalettedSingleBandGray(), drawPalettedSingleBandPseudoColor(), drawSingleBandGray(), and drawSingleBandPseudoColor().
| QString QgsRasterLayer::projectionWkt | ( | ) | [private] |
Query GDAL to find out the Wkt projection string for this layer.
Definition at line 4903 of file qgsrasterlayer.cpp.
References QgsCoordinateReferenceSystem::createFromWkt(), QgsCoordinateReferenceSystem::isValid(), and mGdalDataset.
Referenced by readFile().
| void * QgsRasterLayer::readData | ( | GDALRasterBandH | gdalBand, | |
| QgsRasterViewPort * | viewPort | |||
| ) | [private] |
Allocate memory and load data to that allocated memory.
Definition at line 4932 of file qgsrasterlayer.cpp.
References QgsRasterViewPort::clippedHeight, QgsRasterViewPort::clippedWidth, QgsRasterViewPort::drawableAreaXDim, QgsRasterViewPort::drawableAreaYDim, QgsMapLayer::name(), QgsDebugMsg, QgsRasterViewPort::rectXOffset, QgsRasterViewPort::rectYOffset, QgsMapLayer::type(), and QgsLogger::warning().
Referenced by drawMultiBandColor(), drawPalettedSingleBandColor(), drawPalettedSingleBandGray(), drawPalettedSingleBandPseudoColor(), drawSingleBandGray(), and drawSingleBandPseudoColor().
| bool QgsRasterLayer::readFile | ( | const QString & | fileName | ) | [private] |
Load the given raster file.
Definition at line 4977 of file qgsrasterlayer.cpp.
References bandName(), QgsRasterBandStats::bandName, QgsRasterBandStats::bandNumber, buildPyramidList(), ColorRampShader, colorTable(), QgsRasterBandStats::colorTable, QgsCoordinateReferenceSystem::createFromWkt(), GrayOrUndefined, hasBand(), QgsRasterBandStats::histogramVector, QgsRasterTransparency::initializeTransparentPixelList(), QgsMapLayerRegistry::instance(), QgsColorRampShader::INTERPOLATED, QgsMapLayer::isValid(), QgsCoordinateReferenceSystem::isValid(), lastModified(), 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, Palette, PalettedColor, projectionWkt(), QgsDebugMsg, QgsRasterShader::rasterShaderFunction(), readColorTable(), registerGdalDrivers(), QgsColorRampShader::setColorRampItemList(), QgsColorRampShader::setColorRampType(), setColorShadingAlgorithm(), setContrastEnhancementAlgorithm(), QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), QgsRectangle::setYMaximum(), QgsRectangle::setYMinimum(), SingleBandGray, QgsRasterBandStats::statsGathered, 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] |
Read a raster value given position from memory block created by readData().
Definition at line 5207 of file qgsrasterlayer.cpp.
References QgsLogger::warning().
Referenced by bandStatistics(), drawMultiBandColor(), drawPalettedSingleBandColor(), drawPalettedSingleBandGray(), drawPalettedSingleBandPseudoColor(), drawSingleBandGray(), drawSingleBandPseudoColor(), and identify().
| bool QgsRasterLayer::update | ( | ) | [private] |
Update the layer if it is outdated.
Definition at line 5241 of file qgsrasterlayer.cpp.
References closeDataset(), lastModified(), mLastModified, QgsDebugMsg, readFile(), and QgsMapLayer::source().
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 5266 of file qgsrasterlayer.cpp.
References bandName(), mRasterStatsList, QgsDebugMsg, QSTRING_NOT_SET, and TRSTRING_NOT_SET.
Referenced by setBlueBandName(), setGrayBandName(), setGreenBandName(), setRedBandName(), and setTransparentBandName().
const QString QgsRasterLayer::QSTRING_NOT_SET [private] |
Constant defining flag for XML and a constant that signals property not used.
Definition at line 759 of file qgsrasterlayer.h.
Referenced by validateBandName(), and writeSymbology().
const QString QgsRasterLayer::TRSTRING_NOT_SET [private] |
Definition at line 760 of file qgsrasterlayer.h.
Referenced by draw(), readFile(), validateBandName(), and writeSymbology().
QString QgsRasterLayer::mBlueBandName [private] |
The band to be associated with the color blue - usually 3.
Definition at line 763 of file qgsrasterlayer.h.
Referenced by draw(), drawMultiBandColor(), readFile(), and setBlueBandName().
The raster shading algorithm being used.
Definition at line 766 of file qgsrasterlayer.h.
Referenced by colorShadingAlgorithmAsString(), legendAsPixmap(), setColorShadingAlgorithm(), and setRasterShaderFunction().
QgsContrastEnhancement::ContrastEnhancementAlgorithm QgsRasterLayer::mContrastEnhancementAlgorithm [private] |
The contrast enhancement algorithm being used.
Definition at line 769 of file qgsrasterlayer.h.
Referenced by contrastEnhancementAlgorithmAsString(), and setContrastEnhancementAlgorithm().
List containing the contrast enhancements for each band.
Definition at line 772 of file qgsrasterlayer.h.
Referenced by contrastEnhancement(), maximumValue(), minimumValue(), readFile(), setContrastEnhancementAlgorithm(), setContrastEnhancementFunction(), setMaximumValue(), setMinimumValue(), and writeSymbology().
double QgsRasterLayer::mStandardDeviations [private] |
Number of stddev to plot (0) to ignore.
Not applicable to all layer types
Definition at line 775 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 778 of file qgsrasterlayer.h.
Referenced by dataProvider(), draw(), identifyAsText(), metadata(), QgsRasterLayer(), setDataProvider(), setLayerOrder(), setSubLayerVisibility(), subLayers(), and writeSymbology().
DrawingStyle QgsRasterLayer::mDrawingStyle [private] |
Definition at line 780 of file qgsrasterlayer.h.
Referenced by draw(), drawingStyleAsString(), legendAsPixmap(), readFile(), setDataProvider(), and setDrawingStyle().
bool QgsRasterLayer::mEditable [private] |
[ data provider interface ] Flag indicating wheter the layer is in editing mode or not
Definition at line 783 of file qgsrasterlayer.h.
QString QgsRasterLayer::mError [private] |
[ data provider interface ]The error message associated with the last error
Definition at line 786 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 789 of file qgsrasterlayer.h.
Referenced by draw(), and lastErrorTitle().
GDALDatasetH QgsRasterLayer::mGdalBaseDataset [private] |
Pointer to the gdaldataset.
Definition at line 792 of file qgsrasterlayer.h.
Referenced by buildPyramids(), closeDataset(), readFile(), and ~QgsRasterLayer().
GDALDatasetH QgsRasterLayer::mGdalDataset [private] |
Pointer to the gdaldataset (possibly warped vrt).
Definition at line 795 of file qgsrasterlayer.h.
Referenced by bandStatistics(), buildPyramidList(), buildPyramids(), closeDataset(), computeMinimumMaximumEstimates(), drawMultiBandColor(), drawPalettedSingleBandColor(), drawPalettedSingleBandGray(), drawPalettedSingleBandPseudoColor(), drawSingleBandGray(), drawSingleBandPseudoColor(), hasBand(), identify(), legendAsPixmap(), metadata(), populateHistogram(), projectionWkt(), readColorTable(), readFile(), resetNoDataValue(), and ~QgsRasterLayer().
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 798 of file qgsrasterlayer.h.
Referenced by draw(), 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 801 of file qgsrasterlayer.h.
Referenced by draw(), readFile(), readSymbology(), and setGrayBandName().
bool QgsRasterLayer::mGrayMinimumMaximumEstimated [private] |
Flag to indicate of the min max values are actual or estimates/user defined.
Definition at line 804 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 807 of file qgsrasterlayer.h.
Referenced by draw(), drawMultiBandColor(), readFile(), readSymbology(), and setGreenBandName().
bool QgsRasterLayer::mHasPyramids [private] |
Whether this raster has overviews / pyramids or not.
Definition at line 810 of file qgsrasterlayer.h.
Referenced by buildPyramids(), closeDataset(), legendAsPixmap(), and readFile().
int QgsRasterLayer::mWidth [private] |
Raster width.
Definition at line 813 of file qgsrasterlayer.h.
Referenced by buildPyramidList(), draw(), identify(), readFile(), and thumbnailAsPixmap().
int QgsRasterLayer::mHeight [private] |
Raster height.
Definition at line 816 of file qgsrasterlayer.h.
Referenced by buildPyramidList(), draw(), identify(), readFile(), and thumbnailAsPixmap().
bool QgsRasterLayer::mInvertColor [private] |
Flag indicating whether the color of pixels should be inverted or not.
Definition at line 819 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 822 of file qgsrasterlayer.h.
Referenced by readFile(), and update().
QLibrary* QgsRasterLayer::mLib [private] |
[ data provider interface ] pointer for loading the provider library
Definition at line 825 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 828 of file qgsrasterlayer.h.
double QgsRasterLayer::mNoDataValue [private] |
Cell value representing no data.
e.g. -9999
Definition at line 831 of file qgsrasterlayer.h.
Referenced by bandStatistics(), drawMultiBandColor(), drawPalettedSingleBandColor(), drawPalettedSingleBandGray(), drawPalettedSingleBandPseudoColor(), drawSingleBandGray(), drawSingleBandPseudoColor(), identify(), metadata(), readFile(), resetNoDataValue(), setNoDataValue(), and writeSymbology().
QString QgsRasterLayer::mProviderKey [private] |
[ data provider interface ] Data provider key
Definition at line 834 of file qgsrasterlayer.h.
Referenced by draw(), identify(), identifyAsText(), legendAsPixmap(), metadata(), paletteAsPixmap(), providerKey(), readXml(), setDataProvider(), thumbnailAsPixmap(), usesProvider(), writeSymbology(), writeXml(), and ~QgsRasterLayer().
This list holds a series of RasterPyramid structs which store information for each potential pyramid level.
Definition at line 837 of file qgsrasterlayer.h.
Referenced by buildPyramidList(), and closeDataset().
QgsRasterShader* QgsRasterLayer::mRasterShader [private] |
The raster shader for the layer.
Definition at line 840 of file qgsrasterlayer.h.
Referenced by drawPalettedSingleBandColor(), drawPalettedSingleBandGray(), drawPalettedSingleBandPseudoColor(), drawSingleBandPseudoColor(), QgsRasterLayer(), readFile(), readSymbology(), setColorShadingAlgorithm(), setRasterShaderFunction(), and writeSymbology().
A collection of stats - one for each band in the layer.
Definition at line 843 of file qgsrasterlayer.h.
Referenced by bandCount(), bandName(), bandNumber(), bandStatistics(), closeDataset(), colorTable(), hasStatistics(), readFile(), setNoDataValue(), and validateBandName().
The transparency container.
Definition at line 846 of file qgsrasterlayer.h.
Referenced by drawMultiBandColor(), drawPalettedSingleBandColor(), drawPalettedSingleBandGray(), drawPalettedSingleBandPseudoColor(), drawSingleBandGray(), drawSingleBandPseudoColor(), readFile(), readSymbology(), and writeSymbology().
LayerType QgsRasterLayer::mRasterType [private] |
QString QgsRasterLayer::mRedBandName [private] |
The band to be associated with the color red - usually 1.
Definition at line 851 of file qgsrasterlayer.h.
Referenced by draw(), drawMultiBandColor(), readFile(), readSymbology(), and setRedBandName().
bool QgsRasterLayer::mRGBMinimumMaximumEstimated [private] |
Flag to indicate of the min max values are actual or estimates/user defined.
Definition at line 854 of file qgsrasterlayer.h.
Referenced by drawMultiBandColor(), and QgsRasterLayer().
QString QgsRasterLayer::mTransparencyBandName [private] |
The band to be associated with transparency.
Definition at line 857 of file qgsrasterlayer.h.
Referenced by readFile(), and setTransparentBandName().
bool QgsRasterLayer::mUserDefinedGrayMinimumMaximum [private] |
Flag to indicate if the user entered custom min max values.
Definition at line 860 of file qgsrasterlayer.h.
Referenced by drawSingleBandGray(), and QgsRasterLayer().
bool QgsRasterLayer::mUserDefinedRGBMinimumMaximum [private] |
Flag to indicate if the user entered custom min max values.
Definition at line 863 of file qgsrasterlayer.h.
Referenced by drawMultiBandColor(), and QgsRasterLayer().
bool QgsRasterLayer::mValidNoDataValue [private] |
Flag indicating if the nodatavalue is valid.
Definition at line 866 of file qgsrasterlayer.h.
Referenced by bandStatistics(), drawMultiBandColor(), drawPalettedSingleBandColor(), drawPalettedSingleBandGray(), drawPalettedSingleBandPseudoColor(), drawSingleBandGray(), drawSingleBandPseudoColor(), identify(), metadata(), readFile(), readSymbology(), resetNoDataValue(), setNoDataValue(), and writeSymbology().
1.5.1