QGIS API Documentation
2.2.0-Valmiera
|
The raster file writer which allows you to save a raster to a new file. More...
#include <qgsrasterfilewriter.h>
Public Types | |
enum | Mode { Raw = 0, Image = 1 } |
enum | WriterError { NoError = 0, SourceProviderError = 1, DestProviderError = 2, CreateDatasourceError = 3, WriteError = 4, NoDataConflict = 5 } |
Public Member Functions | |
QgsRasterFileWriter (const QString &outputUrl) | |
~QgsRasterFileWriter () | |
WriterError | writeRaster (const QgsRasterPipe *pipe, int nCols, int nRows, QgsRectangle outputExtent, const QgsCoordinateReferenceSystem &crs, QProgressDialog *p=0) |
Write raster file. | |
void | setOutputFormat (const QString &format) |
QString | outputFormat () const |
void | setOutputProviderKey (const QString &key) |
QString | outputProviderKey () const |
void | setTiledMode (bool t) |
bool | tiledMode () const |
void | setMaxTileWidth (int w) |
int | maxTileWidth () const |
QgsRaster::RasterBuildPyramids | buildPyramidsFlag () const |
void | setBuildPyramidsFlag (QgsRaster::RasterBuildPyramids f) |
QList< int > | pyramidsList () const |
void | setPyramidsList (const QList< int > &list) |
QString | pyramidsResampling () const |
void | setPyramidsResampling (const QString &str) |
QgsRaster::RasterPyramidsFormat | pyramidsFormat () const |
void | setPyramidsFormat (QgsRaster::RasterPyramidsFormat f) |
void | setMaxTileHeight (int h) |
int | maxTileHeight () const |
void | setCreateOptions (const QStringList &list) |
QStringList | createOptions () const |
void | setPyramidsConfigOptions (const QStringList &list) |
QStringList | pyramidsConfigOptions () const |
Private Member Functions | |
QgsRasterFileWriter () | |
WriterError | writeDataRaster (const QgsRasterPipe *pipe, QgsRasterIterator *iter, int nCols, int nRows, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &crs, QProgressDialog *progressDialog=0) |
WriterError | writeDataRaster (const QgsRasterPipe *pipe, QgsRasterIterator *iter, int nCols, int nRows, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &crs, QGis::DataType destDataType, QList< bool > destHasNoDataValueList, QList< double > destNoDataValueList, QgsRasterDataProvider *destProvider, QProgressDialog *progressDialog) |
WriterError | writeImageRaster (QgsRasterIterator *iter, int nCols, int nRows, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &crs, QProgressDialog *progressDialog=0) |
void | createVRT (int xSize, int ySize, const QgsCoordinateReferenceSystem &crs, double *geoTransform, QGis::DataType type, QList< bool > destHasNoDataValueList, QList< double > destNoDataValueList) |
Initialize vrt member variables. | |
bool | writeVRT (const QString &file) |
void | addToVRT (const QString &filename, int band, int xSize, int ySize, int xOffset, int yOffset) |
void | buildPyramids (const QString &filename) |
QgsRasterDataProvider * | createPartProvider (const QgsRectangle &extent, int nCols, int iterCols, int iterRows, int iterLeft, int iterTop, const QString &outputUrl, int fileIndex, int nBands, QGis::DataType type, const QgsCoordinateReferenceSystem &crs) |
Create provider and datasource for a part image (vrt mode) | |
QgsRasterDataProvider * | initOutput (int nCols, int nRows, const QgsCoordinateReferenceSystem &crs, double *geoTransform, int nBands, QGis::DataType type, QList< bool > destHasNoDataValueList=QList< bool >(), QList< double > destNoDataValueList=QList< double >()) |
Init VRT (for tiled mode) or create global output provider (single-file mode) | |
void | globalOutputParameters (const QgsRectangle &extent, int nCols, int &nRows, double *geoTransform, double &pixelSize) |
Calculate nRows, geotransform and pixel size for output. | |
QString | partFileName (int fileIndex) |
QString | vrtFileName () |
Private Attributes | |
Mode | mMode |
QString | mOutputUrl |
QString | mOutputProviderKey |
QString | mOutputFormat |
QStringList | mCreateOptions |
QgsCoordinateReferenceSystem | mOutputCRS |
bool | mTiledMode |
False: Write one file, true: create a directory and add the files numbered. | |
double | mMaxTileWidth |
double | mMaxTileHeight |
QList< int > | mPyramidsList |
QString | mPyramidsResampling |
QgsRaster::RasterBuildPyramids | mBuildPyramidsFlag |
QgsRaster::RasterPyramidsFormat | mPyramidsFormat |
QStringList | mPyramidsConfigOptions |
QDomDocument | mVRTDocument |
QList< QDomElement > | mVRTBands |
QProgressDialog * | mProgressDialog |
const QgsRasterPipe * | mPipe |
const QgsRasterInterface * | mInput |
The raster file writer which allows you to save a raster to a new file.
Definition at line 32 of file qgsrasterfilewriter.h.
Definition at line 35 of file qgsrasterfilewriter.h.
NoError | |
SourceProviderError | |
DestProviderError | |
CreateDatasourceError | |
WriteError | |
NoDataConflict |
Definition at line 40 of file qgsrasterfilewriter.h.
QgsRasterFileWriter::QgsRasterFileWriter | ( | const QString & | outputUrl | ) |
Definition at line 29 of file qgsrasterfilewriter.cpp.
QgsRasterFileWriter::~QgsRasterFileWriter | ( | ) |
Definition at line 44 of file qgsrasterfilewriter.cpp.
|
private |
Definition at line 39 of file qgsrasterfilewriter.cpp.
|
private |
Definition at line 607 of file qgsrasterfilewriter.cpp.
References mVRTBands, and mVRTDocument.
Referenced by writeDataRaster(), and writeImageRaster().
|
private |
Definition at line 687 of file qgsrasterfilewriter.cpp.
References QgsRasterDataProvider::buildPyramidList(), QgsRasterDataProvider::buildPyramids(), QgsProviderRegistry::instance(), mOutputProviderKey, mPyramidsConfigOptions, mPyramidsFormat, mPyramidsList, mPyramidsResampling, QgsProviderRegistry::provider(), QgsDebugMsg, and tr.
Referenced by writeDataRaster(), and writeImageRaster().
|
inline |
Definition at line 76 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 92 of file qgsrasterfilewriter.h.
|
private |
Create provider and datasource for a part image (vrt mode)
Definition at line 862 of file qgsrasterfilewriter.cpp.
References QgsRasterDataProvider::create(), mCreateOptions, mOutputFormat, mOutputProviderKey, partFileName(), QgsRectangle::width(), QgsRectangle::xMinimum(), and QgsRectangle::yMaximum().
Referenced by writeDataRaster(), and writeImageRaster().
|
private |
Initialize vrt member variables.
xSize | width of vrt |
ySize | height of vrt |
crs | coordinate system of vrt |
geoTransform | optional array of transformation matrix values |
type | datatype of vrt |
destHasNoDataValueList | true if destination has no data value, indexed from 0 |
destNoDataValueList | no data value, indexed from 0 |
Definition at line 770 of file qgsrasterfilewriter.cpp.
References QgsRasterInterface::bandCount(), QGis::Byte, QGis::CFloat32, QGis::CFloat64, QGis::CInt16, QGis::CInt32, QGis::Float32, QGis::Float64, Image, QGis::Int16, mInput, mMode, mVRTBands, mVRTDocument, Raw, QgsCoordinateReferenceSystem::toWkt(), QGis::UInt16, and QGis::UInt32.
Referenced by initOutput().
|
private |
Calculate nRows, geotransform and pixel size for output.
Definition at line 921 of file qgsrasterfilewriter.cpp.
References QgsRectangle::height(), QgsRectangle::width(), QgsRectangle::xMinimum(), and QgsRectangle::yMaximum().
Referenced by writeDataRaster(), and writeImageRaster().
|
private |
Init VRT (for tiled mode) or create global output provider (single-file mode)
nCols | number of tile columns |
nRows | number of tile rows |
crs | coordinate system of vrt |
geoTransform | optional array of transformation matrix values |
nBands | number of bands |
type | datatype of vrt |
destHasNoDataValueList | true if destination has no data value, indexed from 0 |
destNoDataValueList | no data value, indexed from 0 |
Definition at line 892 of file qgsrasterfilewriter.cpp.
References QgsRasterDataProvider::create(), createVRT(), mBuildPyramidsFlag, mCreateOptions, mOutputFormat, mOutputProviderKey, mOutputUrl, mTiledMode, and QgsDebugMsg.
Referenced by writeDataRaster(), and writeImageRaster().
|
inline |
Definition at line 89 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 74 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 65 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 68 of file qgsrasterfilewriter.h.
|
private |
Definition at line 939 of file qgsrasterfilewriter.cpp.
References mOutputUrl.
Referenced by createPartProvider(), writeDataRaster(), and writeImageRaster().
|
inline |
Definition at line 95 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 85 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 79 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 82 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 77 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 91 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 88 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 73 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 64 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 67 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 94 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 86 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 80 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 83 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 70 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 71 of file qgsrasterfilewriter.h.
|
private |
Definition at line 946 of file qgsrasterfilewriter.cpp.
References mOutputUrl.
Referenced by writeDataRaster(), and writeImageRaster().
|
private |
Definition at line 119 of file qgsrasterfilewriter.cpp.
References QgsRasterInterface::bandCount(), QgsRasterInterface::bandStatistics(), QgsRectangle::contains(), QgsRasterProjector::destCrs(), DestProviderError, QgsRasterDataProvider::extent(), globalOutputParameters(), initOutput(), QgsRasterPipe::last(), QgsRasterBandStats::Max, QgsRasterBandStats::maximumValue, QgsContrastEnhancement::maximumValuePossible(), QgsRasterBandStats::Min, QgsRasterBandStats::minimumValue, mMaxTileHeight, mMaxTileWidth, QgsRasterNuller::noData(), NoDataConflict, QgsRasterPipe::nuller(), QgsRasterPipe::projector(), QgsDebugMsg, QgsRasterDataProvider::remove(), QgsRasterIterator::setMaximumTileHeight(), QgsRasterIterator::setMaximumTileWidth(), QgsRasterNuller::setOutputNoDataValue(), SourceProviderError, QgsRasterProjector::srcCrs(), QgsRasterDataProvider::srcDataType(), QgsRasterDataProvider::srcHasNoDataValue(), QgsRasterInterface::srcInput(), QgsRasterDataProvider::srcNoDataValue(), QgsRasterBlock::typeSize(), and QgsRasterBlock::typeWithNoDataValue().
Referenced by writeRaster().
|
private |
Definition at line 296 of file qgsrasterfilewriter.cpp.
References addToVRT(), QgsRasterInterface::bandCount(), buildPyramids(), createPartProvider(), QgsRasterDataProvider::dataType(), QgsRasterIterator::input(), QgsRasterIterator::maximumTileHeight(), QgsRasterIterator::maximumTileWidth(), mBuildPyramidsFlag, mOutputUrl, mTiledMode, NoError, partFileName(), QgsRaster::PyramidsFlagYes, QgsDebugMsg, QgsRasterIterator::readNextRasterPart(), QgsRasterDataProvider::setNoDataValue(), QgsRasterInterface::srcInput(), QgsRasterIterator::startRasterRead(), tr, vrtFileName(), QgsRasterDataProvider::write(), and writeVRT().
|
private |
Definition at line 446 of file qgsrasterfilewriter.cpp.
References addToVRT(), QGis::ARGB32, QGis::ARGB32_Premultiplied, buildPyramids(), QGis::Byte, QgsRasterBlock::color(), createPartProvider(), QgsRasterInterface::dataType(), globalOutputParameters(), initOutput(), QgsRasterIterator::input(), QgsRasterIterator::maximumTileHeight(), QgsRasterIterator::maximumTileWidth(), mBuildPyramidsFlag, mMaxTileHeight, mMaxTileWidth, mOutputUrl, mTiledMode, NoError, partFileName(), QgsRaster::PyramidsFlagYes, QgsDebugMsg, QgsDebugMsgLevel, qgsFree(), qgsMalloc(), QgsRasterIterator::readNextRasterPart(), QgsRasterIterator::setMaximumTileHeight(), QgsRasterIterator::setMaximumTileWidth(), QgsRasterBlock::setValue(), SourceProviderError, QgsRasterIterator::startRasterRead(), tr, vrtFileName(), QgsRasterDataProvider::write(), and writeVRT().
Referenced by writeRaster().
QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeRaster | ( | const QgsRasterPipe * | pipe, |
int | nCols, | ||
int | nRows, | ||
QgsRectangle | outputExtent, | ||
const QgsCoordinateReferenceSystem & | crs, | ||
QProgressDialog * | p = 0 |
||
) |
Write raster file.
pipe | raster pipe |
nCols | number of output columns |
nRows | number of output rows (or -1 to automatically calculate row number to have square pixels) |
outputExtent | extent to output |
crs | crs to reproject to |
p | dialog to show progress in |
Definition at line 49 of file qgsrasterfilewriter.cpp.
References CreateDatasourceError, QgsRasterInterface::dataType(), Image, QgsRasterPipe::last(), mInput, mMode, mOutputUrl, mPipe, mProgressDialog, mTiledMode, QgsDebugMsg, Raw, SourceProviderError, QgsRasterInterface::srcInput(), QgsRasterBlock::typeIsColor(), writeDataRaster(), and writeImageRaster().
|
private |
Definition at line 849 of file qgsrasterfilewriter.cpp.
References mVRTDocument.
Referenced by writeDataRaster(), and writeImageRaster().
|
private |
Definition at line 174 of file qgsrasterfilewriter.h.
Referenced by initOutput(), writeDataRaster(), and writeImageRaster().
|
private |
Definition at line 164 of file qgsrasterfilewriter.h.
Referenced by createPartProvider(), and initOutput().
|
private |
Definition at line 184 of file qgsrasterfilewriter.h.
Referenced by createVRT(), and writeRaster().
|
private |
Definition at line 170 of file qgsrasterfilewriter.h.
Referenced by writeDataRaster(), and writeImageRaster().
|
private |
Definition at line 169 of file qgsrasterfilewriter.h.
Referenced by writeDataRaster(), and writeImageRaster().
|
private |
Definition at line 160 of file qgsrasterfilewriter.h.
Referenced by createVRT(), and writeRaster().
|
private |
Definition at line 165 of file qgsrasterfilewriter.h.
|
private |
Definition at line 163 of file qgsrasterfilewriter.h.
Referenced by createPartProvider(), and initOutput().
|
private |
Definition at line 162 of file qgsrasterfilewriter.h.
Referenced by buildPyramids(), createPartProvider(), and initOutput().
|
private |
Definition at line 161 of file qgsrasterfilewriter.h.
Referenced by initOutput(), partFileName(), vrtFileName(), writeDataRaster(), writeImageRaster(), and writeRaster().
|
private |
Definition at line 183 of file qgsrasterfilewriter.h.
Referenced by writeRaster().
|
private |
Definition at line 181 of file qgsrasterfilewriter.h.
Referenced by writeRaster().
|
private |
Definition at line 176 of file qgsrasterfilewriter.h.
Referenced by buildPyramids().
|
private |
Definition at line 175 of file qgsrasterfilewriter.h.
Referenced by buildPyramids().
|
private |
Definition at line 172 of file qgsrasterfilewriter.h.
Referenced by buildPyramids().
|
private |
Definition at line 173 of file qgsrasterfilewriter.h.
Referenced by buildPyramids().
|
private |
False: Write one file, true: create a directory and add the files numbered.
Definition at line 168 of file qgsrasterfilewriter.h.
Referenced by initOutput(), writeDataRaster(), writeImageRaster(), and writeRaster().
|
private |
Definition at line 179 of file qgsrasterfilewriter.h.
Referenced by addToVRT(), and createVRT().
|
private |
Definition at line 178 of file qgsrasterfilewriter.h.
Referenced by addToVRT(), createVRT(), and writeVRT().