Logo Search packages:      
Sourcecode: qgis version File versions

QgsRasterLayer Class Reference

#include <qgsrasterlayer.h>

Inheritance diagram for QgsRasterLayer:

QgsMapLayer

List of all members.


Detailed Description

This typedef is used when the showProgress function is passed to gdal as a function pointer.

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

Definition at line 318 of file qgsrasterlayer.h.


Public Types

enum  COLOR_RAMPING_TYPE { BLUE_GREEN_RED, FREAK_OUT }
 This enumerator describes the types of histogram colour ramping that can be used.
enum  COLOR_SCALING_ALGORITHM { STRETCH_TO_MINMAX, STRETCH_AND_CLIP_TO_MINMAX, CLIP_TO_MINMAX }
 This enumerator describes the types of histogram scaling algorithms that can be used.
enum  DRAWING_STYLE {
  SINGLE_BAND_GRAY, SINGLE_BAND_PSEUDO_COLOR, PALETTED_COLOR, PALETTED_SINGLE_BAND_GRAY,
  PALETTED_SINGLE_BAND_PSEUDO_COLOR, PALETTED_MULTI_BAND_COLOR, MULTI_BAND_SINGLE_BAND_GRAY, MULTI_BAND_SINGLE_BAND_PSEUDO_COLOR,
  MULTI_BAND_COLOR
}
 This enumerator describes the different kinds of drawing we can do.
enum  LAYERS { VECTOR, RASTER, DATABASE }
 Layers enum defining the types of layers that can be added to a map.
enum  RASTER_LAYER_TYPE { GRAY_OR_UNDEFINED, PALETTE, MULTIBAND }
 This enumerator describes the type of raster layer.

Public Slots

void buildPyramids (RasterPyramidList, QString theResamplingMethod="NEAREST")
 Create gdal pyramid overviews for this layer. This will speed up performance at the expense of hard drive space. Also, write access to the file is required. If no paramter is passed in it will default to nearest neighbor resampling.
void inOverview (bool)
void keyPressed (QKeyEvent *e)
 keyPress event so we can check if cancel was pressed
float maxScale ()
float minScale ()
void popupTransparencySliderMoved (int)
 Slot called when the popup menu transparency slider has been moved.
bool scaleBasedVisibility ()
void setMaxScale (float theMaxScale)
void setMinScale (float theMinScale)
void setScaleBasedVisibility (bool theVisibilityFlag)
void setVisible (bool vis)
 set visibility
void showLayerProperties ()
 Used at the moment by the above function but hopefully will later be useable by any operation that needs to notify the user of its progress.
void updateItemPixmap ()
void updateOverviewPopupItem ()

Signals

void recalculateExtents ()
virtual void repaintRequested ()
void setProgress (int theProgress, int theTotalSteps)
 emit a signal to notify of a progress event
void setStatus (QString theStatusQString)
 emit a signal to be caught by gisapp and display a msg on status bar
void visibilityChanged (void)
void showInOverview (QgsMapLayer *maplayer, bool)

Public Member Functions

RasterPyramidList buildRasterPyramidList ()
 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.
virtual QgsRect calculateExtent ()
QPopupMenu * contextMenu ()
 Accessor for the superclass's popmenu var - implements the pure virtual funtion.
virtual void draw (QPainter *, QgsRect *, int)
void draw (QPainter *theQPainter, RasterViewPort *myRasterViewPort)
 This is an overloaded version of the above function that is called by both draw above and drawThumbnail.
void draw (QPainter *theQPainter, QgsRect *theViewExtent, QgsCoordinateTransform *theQgsCoordinateTransform, QPaintDevice *dst)
 This is called when the view on the rasterlayer needs to be refreshed (redrawn).
virtual void drawLabels (QPainter *, QgsRect *, QgsCoordinateTransform *, QPaintDevice *)
void drawThumbnail (QPixmap *theQPixmap)
 Draws a thumbnail of the rasterlayer into the supplied pixmap pointer.
const QgsRect extent ()
virtual long featureCount () const
virtual const int & featureType ()
virtual int fieldCount () const
virtual std::vector< QgsField >
const & 
fields () const
void filterLayer (QImage *theQImage)
 Call any inline image manipulation filters.
const unsigned int getBandCount ()
 Get the number of bands in this layer.
QString getBlueBandName ()
 Accessor for blue band name mapping.
COLOR_RAMPING_TYPE getColorRampingType ()
 Accessor for colour ramping type.
COLOR_SCALING_ALGORITHM getColorScalingAlgorithm ()
 Accessor for colour scaling algorithm.
DRAWING_STYLE getDrawingStyle ()
 Accessor for drawing style.
QString getDrawingStyleAsQString ()
 Returns a string representation of drawing style.
virtual QgsFeaturegetFirstFeature (bool fetchAttributes=false) const
QString getGrayBandName ()
 Accessor for gray band name mapping.
QString getGreenBandName ()
 Accessor for green band name mapping.
bool getHasPyramidsFlag ()
 Accessor for hasPyramidsFlag (READ ONLY).
bool getInvertHistogramFlag ()
 Accessor to find out whether the histogram should be inverted.
QString const & getLayerID () const
QPixmap getLegendQPixmap (bool)
 Overloaded version of above function that can print layer name onto legend.
QPixmap getLegendQPixmap ()
 Get a legend image for this layer.
double getMaxBlueDouble ()
 Accessor for maximum clipping range for blue.
double getMaxGrayDouble ()
 Accessor for maximum clipping range for gray.
double getMaxGreenDouble ()
 Accessor for maximum clipping range for green.
double getMaxRedDouble ()
 Accessor for maximum clipping range for red.
QString getMetadata ()
 Obtain GDAL Metadata for this layer.
double getMinBlueDouble ()
 Accessor for minimum clipping range for blue.
double getMinGrayDouble ()
 Accessor for minimum clipping range for gray.
double getMinGreenDouble ()
 Accessor for minimum clipping range for green.
double getMinRedDouble ()
 Accessor for minimum clipping range for red.
virtual bool getNextFeature (QgsFeature &feature, bool fetchAttributes=false) const
virtual QgsFeaturegetNextFeature (bool fetchAttributes=false) const
const double getNoDataValue ()
 Accessor that returns the NO_DATA entry for this raster.
QPixmap getPaletteAsPixmap ()
 Get an 8x8 pixmap of the colour palette. If the layer has no palette a white pixmap will be returned.
const QString getRasterBandName (int theBandNoInt)
 Get the name of a band given its number.
const int getRasterBandNumber (QString theBandNameQString)
 Get the number of a band given its name. Note this will be 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!
const RasterBandStats getRasterBandStats (QString)
 Overloaded method that also returns stats for a band, but uses the band colour name Note this approach is not recommeneded because it is possible for two gdal raster bands to have the same name!
const RasterBandStats getRasterBandStats (int)
 Get RasterBandStats for a band given its number (read only).
RASTER_LAYER_TYPE getRasterLayerType ()
 Accessor for raster layer type (which is a read only property).
const int getRasterXDim ()
 Accessor that returns the width of the (unclipped) raster.
const int getRasterYDim ()
 Accessor that returns the height of the (unclipped) raster.
QString getRedBandName ()
 Accessor for red band name (allows alternate mappings e.g. map blue as red colour).
bool getShowDebugOverlayFlag ()
 Accessor for a flag that determines whether to show some debug info on the image.
double getStdDevsToPlot ()
 Accessor to find out how many standard deviations are being plotted.
unsigned int getTransparency ()
 accessor for transparency level.
bool hasBand (QString theBandName)
 Find out whether a given band exists.
const bool hasStats (int theBandNoInt)
 Check whether a given band number has stats associated with it.
virtual void identify (QgsRect *)
void initContextMenu (QgisApp *app)
void initContextMenu_ (QgisApp *)
bool isEditable () const
 Helper method to retrieve the nth pyramid layer struct from the PyramidList. If the nth layer does not exist, NULL will be returned.
bool isValid ()
virtual const QString & labelField ()
QgsLegendItemlegendItem ()
QPixmap * legendPixmap ()
 Similar to above but returns a pointer. Implemented for qgsmaplayer interface. Always overlays legend name!
QString const & name () const
 QgsRasterLayer (QString path=0, QString baseName=0)
 This is the constructor for the RasterLayer class.
bool readXML (QDomNode &layer_node)
virtual void select (QgsRect *, bool)
void setBlueBandName (QString theBandNameQString)
 Mutator for blue band name mapping.
void setColorRampingType (COLOR_RAMPING_TYPE theRamping)
 Mutator for color scaling algorithm.
void setColorScalingAlgorithm (COLOR_SCALING_ALGORITHM theAlgorithm)
 Mutator for color scaling algorithm.
void setDrawingStyle (QString theDrawingStyleQString)
 Overloaded version of the above function for convenience when restoring from xml.
void setDrawingStyle (DRAWING_STYLE theDrawingStyle)
 Mutator for drawing style.
virtual void setFeatureType (const int &_newVal)
void setGrayBandName (QString theBandNameQString)
 Mutator for gray band name mapping.
void setGreenBandName (QString theBandNameQString)
 Mutator for green band name mapping.
void setInvertHistogramFlag (bool theFlag)
 Mutator to alter the state of the invert histogram flag.
virtual void setLabelField (const QString &_newVal)
void setLayerName (const QString &name)
void setLegendItem (QgsLegendItem *li)
void setMaxBlueDouble (double theDouble)
 Mutator for maximum clipping range for blue.
void setMaxGrayDouble (double theDouble)
 Mutator for maximum clipping range for gray.
void setMaxGreenDouble (double theDouble)
 Mutator for maximum clipping range for green.
void setMaxRedDouble (double theDouble)
 Mutator for maximum clipping range for red.
void setMinBlueDouble (double theDouble)
 Mutator for minimum clipping range for blue.
void setMinGrayDouble (double theDouble)
 Mutator for minimum clipping range for gray.
void setMinGreenDouble (double theDouble)
 Mutator for minimum clipping range for green.
void setMinRedDouble (double theDouble)
 Mutator for minimum clipping range for red.
void setNoDataValue (double theNoDataDouble)
 Mutator that allows the NO_DATA entry for this raster to be overridden.
void setRedBandName (QString theBandNameQString)
 Mutator for red band name (allows alternate mappings e.g. map blue as red colour).
void setShowDebugOverlayFlag (bool theFlag)
 Mutator for a flag that determines whether to show some debug info on the image.
void setStdDevsToPlot (double theDouble)
 Mutator to alter the number of standard deviations that should be plotted.
void setTransparency (int)
 Mutator for transparency level. Should be between 0 and 255.
bool showInOverviewStatus ()
QString const & source () const
 Returns the source for the layer.
QString const & sourceName () const
virtual void table ()
void triggerRepaint ()
 Emit a signal asking for a repaint. (inherited from maplayer).
const int type ()
bool visible ()
 Visibility of the layer.
bool writeXML (QDomNode &layer_node, QDomDocument &document)
 ~QgsRasterLayer ()
 The destuctor.

Static Public Member Functions

static void buildSupportedRasterFileFilter (QString &fileFilters)
static bool isSupportedRasterDriver (QString const &driverName)
static bool isValidRasterFileName (QString *theFileNameQString)
static bool isValidRasterFileName (QString theFileNameQString)

Public Attributes

enum
QgsRasterLayer::COLOR_RAMPING_TYPE 
colorRampingType
 This enumerator describes the types of histogram colour ramping that can be used.
enum
QgsRasterLayer::COLOR_SCALING_ALGORITHM 
colorScalingAlgorithm
 This enumerator describes the types of histogram scaling algorithms that can be used.
enum QgsRasterLayer::DRAWING_STYLE drawingStyle
 This enumerator describes the different kinds of drawing we can do.
QString m_labelField
enum
QgsRasterLayer::RASTER_LAYER_TYPE 
rasterLayerType
 This enumerator describes the type of raster layer.

Protected Member Functions

bool readXML_ (QDomNode &layer_node)
bool writeXML_ (QDomNode &layer_node, QDomDocument &doc)

Protected Attributes

QString dataSource
 data source description string, varies by layer type
int geometryType
 Geometry type as defined in enum WKBTYPE (qgis.h).
QString internalName
QgsRect layerExtent
 Extent of the layer.
QString layerName
QgsLegendItemm_legendItem
QPixmap m_legendPixmap
bool mDrawingCancelled
QPixmap mEditablePixmap
QPixmap mInOverviewPixmap
 A little pixmap to show if this layer is represented in overview or now.
bool mShowInOverview
int mShowInOverviewItemId
 checkable item id in popmenu that sets overview status
QLabel * myPopupLabel
 label for popMenu
QPopupMenu * popMenu
 context menu
bool valid
 Indicates if the layer is valid and can be drawn.

Private Member Functions

QgsColorTable * colorTable (int theBandNoInt)
 Color table.
void drawMultiBandColor (QPainter *theQPainter, RasterViewPort *theRasterViewPort)
 Drawing routine for multiband image.
void drawMultiBandSingleBandGray (QPainter *theQPainter, RasterViewPort *theRasterViewPort, int theBandNoInt)
 Drawing routine for multiband image, rendered as a single band image in grayscale.
void drawMultiBandSingleBandPseudoColor (QPainter *theQPainter, RasterViewPort *theRasterViewPort, int theBandNoInt)
 Drawing routine for multiband image, rendered as a single band image in pseudocolor.
void drawPalettedMultiBandColor (QPainter *theQPainter, RasterViewPort *theRasterViewPort, int theBandNoInt)
 Drawing routine for paletted multiband image.
void drawPalettedSingleBandColor (QPainter *theQPainter, RasterViewPort *theRasterViewPort, int theBandNoInt)
 Drawing routine for paletted image, rendered as a single band image in color.
void drawPalettedSingleBandGray (QPainter *theQPainter, RasterViewPort *theRasterViewPort, int theBandNoInt, QString theColorQString)
 Drawing routine for paletted image, rendered as a single band image in grayscale.
void drawPalettedSingleBandPseudoColor (QPainter *theQPainter, RasterViewPort *theRasterViewPort, int theBandNoInt, QString theColorQString)
 Drawing routine for paletted image, rendered as a single band image in pseudocolor.
void drawSingleBandGray (QPainter *theQPainter, RasterViewPort *theRasterViewPort, int theBandNoInt)
 Drawing routine for single band grayscale image.
void drawSingleBandPseudoColor (QPainter *theQPainter, RasterViewPort *theRasterViewPort, int theBandNoInt)
 Drawing routine for single band grayscale image, rendered in pseudocolor.
void readColorTable (GDALRasterBand *gdalBand, QgsColorTable *theColorTable)
 Read color table from GDAL raster band.
void * readData (GDALRasterBand *gdalBand, RasterViewPort *viewPort)
 Allocate memory and load data to that allocated memory, data type is the same as raster band. The memory must be released later!
bool readFile (QString const &fileName)
double readValue (void *data, GDALDataType type, int index)
 Read a raster value on given position from memory block created by readData().
void showDebugOverlay (QPainter *theQPainter, RasterViewPort *theRasterViewPort)
 Paint debug information onto the output image.

Private Attributes

double adfGeoTransform [6]
 Values for mapping pixel to world coordinates.
QString blueBandNameQString
 The band to be associated with the color blue - usually 3.
QString blueTranslatedQString
GDALDataset * gdalDataset
 Pointer to the gdaldataset.
QString grayBandNameQString
 The band to be associated with the grayscale only ouput - usually 1.
QString greenBandNameQString
 The band to be associated with the color green - usually 2.
QString greenTranslatedQString
bool hasPyramidsFlag
 Whether this raster has overviews / pyramids or not.
bool invertHistogramFlag
 Flag indicating whether the histogram should be inverted or not.
double maxBlueDouble
 Maximum blue value - used in scaling procedure.
double maxGrayDouble
 Maximum gray value - used in scaling procedure.
double maxGreenDouble
 Maximum green value - used in scaling procedure.
double maxRedDouble
 Maximum red value - used in scaling procedure.
double minBlueDouble
 Minimum blue value - used in scaling procedure.
double minGrayDouble
 Minimum gray value - used in scaling procedure.
double minGreenDouble
 Minimum green value - used in scaling procedure.
double minRedDouble
 Minimum red value - used in scaling procedure.
QgsRasterLayerPropertiesmLayerProperties
QPixmap mNoPyramidPixmap
RasterPyramidList mPyramidList
 This list holds a series of RasterPyramid structs which store infomation for each potential pyramid level for this raster.
QPixmap mPyramidPixmap
 These are two little icons used to indicate whether a layer has pyramds bult or not.
QSlider * mTransparencySlider
double noDataValueDouble
 Cell value representing no data. e.g. -9999.
RasterStatsVector rasterStatsVector
 A collection of stats - one for each band in the layer. The typedef for this is defined above before class declaration.
int rasterXDimInt
 Raster width.
int rasterYDimInt
 Raster Height.
QString redBandNameQString
 The band to be associated with the color red - usually 1.
QString redTranslatedQString
bool showDebugOverlayFlag
 Flag to indicate whether debug infor overlay should be rendered onto the raster.
double stdDevsToPlotDouble
 Number of stddev to plot (0) to ignore. Not applicable to all layer types.
unsigned int transparencyLevelInt
 Transparency level for this layer should be 0-255.

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

Generated by  Doxygen 1.6.0   Back to index