mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-24 00:47:57 -05:00
252 lines
8.8 KiB
Plaintext
252 lines
8.8 KiB
Plaintext
|
|
/** Base class for raster data providers
|
|
*
|
|
* \note This class has been copied and pasted from
|
|
* QgsVectorDataProvider, and does not yet make
|
|
* sense for Raster layers.
|
|
*/
|
|
|
|
class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qgsrasterdataprovider.h>
|
|
#include <qgsrasterinterface.h>
|
|
%End
|
|
|
|
public:
|
|
|
|
//! If you add to this, please also add to capabilitiesString()
|
|
enum Capability
|
|
{
|
|
NoCapabilities,
|
|
Identify,
|
|
ExactMinimumMaximum,
|
|
ExactResolution,
|
|
EstimatedMinimumMaximum,
|
|
BuildPyramids,
|
|
Histogram,
|
|
Size,
|
|
Create,
|
|
Remove
|
|
};
|
|
|
|
// This is modified copy of GDALColorInterp
|
|
enum ColorInterpretation
|
|
{
|
|
UndefinedColorInterpretation = 0,
|
|
/*! Greyscale */ GrayIndex = 1,
|
|
/*! Paletted (see associated color table) */ PaletteIndex = 2, // indexed color table
|
|
/*! Red band of RGBA image */ RedBand = 3,
|
|
/*! Green band of RGBA image */ GreenBand = 4,
|
|
/*! Blue band of RGBA image */ BlueBand = 5,
|
|
/*! Alpha (0=transparent, 255=opaque) */ AlphaBand = 6,
|
|
/*! Hue band of HLS image */ HueBand = 7,
|
|
/*! Saturation band of HLS image */ SaturationBand = 8,
|
|
/*! Lightness band of HLS image */ LightnessBand = 9,
|
|
/*! Cyan band of CMYK image */ CyanBand = 10,
|
|
/*! Magenta band of CMYK image */ MagentaBand = 11,
|
|
/*! Yellow band of CMYK image */ YellowBand = 12,
|
|
/*! Black band of CMLY image */ BlackBand = 13,
|
|
/*! Y Luminance */ YCbCr_YBand = 14,
|
|
/*! Cb Chroma */ YCbCr_CbBand = 15,
|
|
/*! Cr Chroma */ YCbCr_CrBand = 16,
|
|
/*! Continuous palette, QGIS addition, GRASS */ ContinuousPalette = 17,
|
|
/*! Max current value */ ColorInterpretationMax = 17
|
|
};
|
|
|
|
// Progress types
|
|
enum RasterProgressType
|
|
{
|
|
ProgressHistogram = 0,
|
|
ProgressPyramids = 1,
|
|
ProgressStatistics = 2
|
|
};
|
|
|
|
enum RasterBuildPyramids
|
|
{
|
|
PyramidsFlagNo = 0,
|
|
PyramidsFlagYes = 1,
|
|
CopyExisting = 2
|
|
};
|
|
|
|
enum RasterPyramidsFormat
|
|
{
|
|
PyramidsGTiff = 0,
|
|
PyramidsInternal = 1,
|
|
PyramidsErdas = 2
|
|
};
|
|
|
|
QgsRasterDataProvider();
|
|
|
|
QgsRasterDataProvider( const QString & uri );
|
|
|
|
virtual ~QgsRasterDataProvider();
|
|
|
|
virtual QgsRasterInterface * clone() const = 0;
|
|
|
|
/**
|
|
* Add the list of WMS layer names to be rendered by this server
|
|
*/
|
|
virtual void addLayers( const QStringList & layers,
|
|
const QStringList & styles = QStringList() ) = 0;
|
|
|
|
//! get raster image encodings supported by (e.g.) the WMS Server, expressed as MIME types
|
|
virtual QStringList supportedImageEncodings() = 0;
|
|
|
|
/**
|
|
* Get the image encoding (as a MIME type) used in the transfer from (e.g.) the WMS server
|
|
*/
|
|
virtual QString imageEncoding() const = 0;
|
|
|
|
/**
|
|
* Set the image encoding (as a MIME type) used in the transfer from (e.g.) the WMS server
|
|
*/
|
|
virtual void setImageEncoding( const QString & mimeType ) = 0;
|
|
|
|
/**
|
|
* Set the image projection (in WMS CRS format) used in the transfer from (e.g.) the WMS server
|
|
*/
|
|
virtual void setImageCrs( const QString & crs ) = 0;
|
|
|
|
|
|
// TODO: Document this better.
|
|
/** \brief Renders the layer as an image
|
|
*/
|
|
virtual QImage* draw( const QgsRectangle & viewExtent, int pixelWidth, int pixelHeight ) = 0;
|
|
|
|
/** Returns a bitmask containing the supported capabilities
|
|
Note, some capabilities may change depending on whether
|
|
a spatial filter is active on this provider, so it may
|
|
be prudent to check this value per intended operation.
|
|
*/
|
|
virtual int capabilities() const;
|
|
|
|
/**
|
|
* Returns the above in friendly format.
|
|
*/
|
|
QString capabilitiesString() const;
|
|
|
|
|
|
// TODO: Get the supported formats by this provider
|
|
|
|
// TODO: Get the file masks supported by this provider, suitable for feeding into the file open dialog box
|
|
|
|
// TODO: add other missing bindings (histo, pyramids and others)
|
|
|
|
/** If the provider supports it, return band stats for the
|
|
given band. Default behaviour is to blockwise read the data
|
|
and generate the stats unless the provider overloads this function. */
|
|
//virtual QgsRasterBandStats bandStatistics( int theBandNo );
|
|
|
|
/** \brief Get band statistics.
|
|
* @param theBandNo The band (number).
|
|
* @param theStats Requested statistics
|
|
* @param theExtent Extent used to calc histogram, if empty, whole raster extent is used.
|
|
* @param theSampleSize Approximate number of cells in sample. If 0, all cells (whole raster will be used). If raster does not have exact size (WCS without exact size for example), provider decides size of sample.
|
|
* @return Band statistics.
|
|
*/
|
|
virtual QgsRasterBandStats bandStatistics( int theBandNo,
|
|
int theStats = QgsRasterBandStats::All,
|
|
const QgsRectangle & theExtent = QgsRectangle(),
|
|
int theSampleSize = 0 );
|
|
|
|
/** \brief Returns true if histogram is available (cached, already calculated), the parameters are the same as in histogram() */
|
|
virtual bool hasStatistics( int theBandNo,
|
|
int theStats = QgsRasterBandStats::All,
|
|
const QgsRectangle & theExtent = QgsRectangle(),
|
|
int theSampleSize = 0 );
|
|
|
|
/**
|
|
* Get metadata in a format suitable for feeding directly
|
|
* into a subset of the GUI raster properties "Metadata" tab.
|
|
*/
|
|
virtual QString metadata() = 0;
|
|
|
|
/**
|
|
* \brief Identify details from a server (e.g. WMS) from the last screen update
|
|
*
|
|
* \param point[in] The pixel coordinate (as it was displayed locally on screen)
|
|
*
|
|
* \return A text document containing the return from the WMS server
|
|
*
|
|
* \note WMS Servers prefer to receive coordinates in image space, therefore
|
|
* this function expects coordinates in that format.
|
|
*
|
|
* \note The arbitraryness of the returned document is enforced by WMS standards
|
|
* up to at least v1.3.0
|
|
*/
|
|
virtual QString identifyAsText( const QgsPoint& point ) = 0;
|
|
|
|
/**
|
|
* \brief Identify details from a server (e.g. WMS) from the last screen update
|
|
*
|
|
* \param point[in] The pixel coordinate (as it was displayed locally on screen)
|
|
*
|
|
* \return A text document containing the return from the WMS server
|
|
*
|
|
* \note WMS Servers prefer to receive coordinates in image space, therefore
|
|
* this function expects coordinates in that format.
|
|
*
|
|
* \note The arbitraryness of the returned document is enforced by WMS standards
|
|
* up to at least v1.3.0
|
|
*
|
|
* \note added in 1.5
|
|
*/
|
|
virtual QString identifyAsHtml( const QgsPoint& point ) = 0;
|
|
|
|
/**
|
|
* \brief Returns the caption error text for the last error in this provider
|
|
*
|
|
* If an operation returns 0 (e.g. draw()), this function
|
|
* returns the text of the error associated with the failure.
|
|
* Interactive users of this provider can then, for example,
|
|
* call a QMessageBox to display the contents.
|
|
*
|
|
*/
|
|
virtual QString lastErrorTitle() = 0;
|
|
|
|
/**
|
|
* \brief Returns the verbose error text for the last error in this provider
|
|
*
|
|
* If an operation returns 0 (e.g. draw()), this function
|
|
* returns the text of the error associated with the failure.
|
|
* Interactive users of this provider can then, for example,
|
|
* call a QMessageBox to display the contents.
|
|
*
|
|
*/
|
|
virtual QString lastError() = 0;
|
|
|
|
/**
|
|
* \brief Returns the format of the error text for the last error in this provider
|
|
*
|
|
* \note added in 1.6
|
|
*/
|
|
virtual QString lastErrorFormat();
|
|
|
|
/**Returns the dpi of the output device.
|
|
@note: this method was added in version 1.2*/
|
|
int dpi();
|
|
|
|
/**Sets the output device resolution.
|
|
@note: this method was added in version 1.2*/
|
|
void setDpi( int dpi );
|
|
|
|
/** Get block size */
|
|
int xBlockSize() const;
|
|
int yBlockSize() const;
|
|
|
|
/** Get raster size */
|
|
int xSize() const;
|
|
int ySize() const;
|
|
|
|
/** read block of data using give extent and size */
|
|
/*virtual void readBlock( int bandNo,
|
|
QgsRectangle const & viewExtent,
|
|
int width, int height,
|
|
QgsCoordinateReferenceSystem theSrcCRS,
|
|
QgsCoordinateReferenceSystem theDestCRS,
|
|
void *data ); */
|
|
|
|
};
|
|
|