Skip to content

Commit

Permalink
Update api break docs, sipify QgsRasterFileWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Apr 6, 2017
1 parent 9c832ad commit 5ccc6cc
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 42 deletions.
9 changes: 9 additions & 0 deletions doc/api_break.dox
Original file line number Diff line number Diff line change
Expand Up @@ -1681,6 +1681,15 @@ QgsRasterDataProvider {#qgis_api_break_3_0_QgsRasterDataProvider}
- The progress and progressUpdate signals were removed. Methods which previously emitted these
signals now accept a QgsRasterBlockFeedback argument for reporting progress updates.


QgsRasterFileWriter {#qgis_api_break_3_0_QgsRasterFileWriter}
------------------

- writeRaster now uses a QgsRasterBlockFeedback object instead of a QProgressDialog argument. Any use of the old
QProgressDialog argument will need to be updated using manually created connections between QgsRasterBlockFeedback's
signals and the updates to the progress dialog.


QgsRasterInterface {#qgis_api_break_3_0_QgsRasterInterface}
------------------

Expand Down
1 change: 0 additions & 1 deletion python/auto_sip.blacklist
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ core/raster/qgsrasterblock.sip
core/raster/qgsrasterchecker.sip
core/raster/qgsrasterdataprovider.sip
core/raster/qgsrasterdrawer.sip
core/raster/qgsrasterfilewriter.sip
core/raster/qgsrasterhistogram.sip
core/raster/qgsrasteridentifyresult.sip
core/raster/qgsrasterinterface.sip
Expand Down
102 changes: 63 additions & 39 deletions python/core/raster/qgsrasterfilewriter.sip
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterfilewriter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/



/** Raster file writer */

/** \ingroup core
* The raster file writer which allows you to save a raster to a new file.
*/
class QgsRasterFileWriter
{
%Docstring
The raster file writer which allows you to save a raster to a new file.
%End

%TypeHeaderCode
#include <qgsrasterfilewriter.h>
#include <qgsrasterdataprovider.h>
#include "qgsrasterfilewriter.h"
%End
public:
enum Mode
{
Raw, // Raw data
Image, // Rendered image
Raw,
Image
};
enum WriterError
{
Expand All @@ -23,40 +31,49 @@ class QgsRasterFileWriter
DestProviderError,
CreateDatasourceError,
WriteError,
// Internal error if a value used for 'no data' was found in input
NoDataConflict,
WriteCanceled,
};

QgsRasterFileWriter( const QString& outputUrl );

/** Create a raster file with one band without initializing the pixel data.
* Returned provider may be used to initialize the raster using writeBlock() calls.
* Ownership of the returned provider is passed to the caller.
* @note Does not work with tiled mode enabled.
* @returns Instance of data provider in editing mode (on success) or null on error.
* @note added in QGIS 3.0
*/
QgsRasterDataProvider* createOneBandRaster( Qgis::DataType dataType,
int width, int height,
const QgsRectangle& extent,
const QgsCoordinateReferenceSystem& crs ) /Factory/;

/** Write raster file
@param pipe raster pipe
@param nCols number of output columns
@param nRows number of output rows (or -1 to automatically calculate row number to have square pixels)
@param outputExtent extent to output
@param crs crs to reproject to
@param p dialog to show progress in */
WriterError writeRaster( const QgsRasterPipe* pipe, int nCols, int nRows, const QgsRectangle& outputExtent,
const QgsCoordinateReferenceSystem& crs, QgsRasterBlockFeedback *feedback = nullptr );
QgsRasterFileWriter( const QString &outputUrl );

QgsRasterDataProvider *createOneBandRaster( Qgis::DataType dataType,
int width, int height,
const QgsRectangle &extent,
const QgsCoordinateReferenceSystem &crs ) /Factory/;
%Docstring
Create a raster file with one band without initializing the pixel data.
Returned provider may be used to initialize the raster using writeBlock() calls.
Ownership of the returned provider is passed to the caller.
.. note::

Does not work with tiled mode enabled.
\returns Instance of data provider in editing mode (on success) or null on error.
.. versionadded:: 3.0
%End

WriterError writeRaster( const QgsRasterPipe *pipe, int nCols, int nRows, const QgsRectangle &outputExtent,
const QgsCoordinateReferenceSystem &crs, QgsRasterBlockFeedback *feedback = 0 );
%Docstring
Write raster file
\param pipe raster pipe
\param nCols number of output columns
\param nRows number of output rows (or -1 to automatically calculate row number to have square pixels)
\param outputExtent extent to output
\param crs crs to reproject to
\param feedback optional feedback object for progress reports
%End

QString outputUrl() const;
%Docstring
Returns the output URL for the raster.
.. versionadded:: 3.0
%End

void setOutputFormat( const QString& format );
void setOutputFormat( const QString &format );
QString outputFormat() const;

void setOutputProviderKey( const QString& key );
void setOutputProviderKey( const QString &key );
QString outputProviderKey() const;

void setTiledMode( bool t );
Expand All @@ -69,22 +86,29 @@ class QgsRasterFileWriter
void setBuildPyramidsFlag( QgsRaster::RasterBuildPyramids f );

QList< int > pyramidsList() const;
void setPyramidsList( const QList< int > & list );

void setPyramidsList( const QList< int > &list );

QString pyramidsResampling() const;
void setPyramidsResampling( const QString & str );
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 );
void setCreateOptions( const QStringList &list );
QStringList createOptions() const;

void setPyramidsConfigOptions( const QStringList& list );
void setPyramidsConfigOptions( const QStringList &list );
QStringList pyramidsConfigOptions() const;

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterfilewriter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
2 changes: 1 addition & 1 deletion scripts/sipify.pl
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ sub processDoxygenLine
}

# remove function bodies
if ( $line =~ m/^(\s*)?(const )?(virtual |static )?((\w+(<.*?>)?\s+(\*|&)?)?(\w+|operator.)\(.*?(\(.*\))*.*\)( (?:const|SIP_[A-Z_]*?))*)\s*(\{.*\})?(?!;)(\s*\/\/.*)?$/ ){
if ( $line =~ m/^(\s*)?(const )?(virtual |static )?(([\w:]+(<.*?>)?\s+(\*|&)?)?(\w+|operator.)\(.*?(\(.*\))*.*\)( (?:const|SIP_[A-Z_]*?))*)\s*(\{.*\})?(?!;)(\s*\/\/.*)?$/ ){
my $newline = "$1$2$3$4;\n";
if ($line !~ m/\{.*?\}$/){
$line = readline $header;
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgsrasterfilewriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class CORE_EXPORT QgsRasterFileWriter
QgsRasterDataProvider *createOneBandRaster( Qgis::DataType dataType,
int width, int height,
const QgsRectangle &extent,
const QgsCoordinateReferenceSystem &crs );
const QgsCoordinateReferenceSystem &crs ) SIP_FACTORY;

/** Write raster file
\param pipe raster pipe
Expand Down
5 changes: 5 additions & 0 deletions tests/scripts/sipifyheader.expected.sip
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ complex default value and type (i.e. containing commas) should be given as a str
void removeProxyFactory( QNetworkProxyFactory *factory /TransferBack/ );

bool removeFunctionBody( const QList<int, QString> &list, QgsVectorLayer *vl );
QgsRaster::RasterBuildPyramids buildPyramidsFlag() const;
%Docstring
Removing function body with namespaced return value
%End


virtual int overriddenProperty();
protected:
Expand Down
3 changes: 3 additions & 0 deletions tests/scripts/sipifyheader.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas

bool removeFunctionBody( const QList<int, QString> &list, QgsVectorLayer *vl ) { doSomething; return true; } // some comments

//! Removing function body with namespaced return value
QgsRaster::RasterBuildPyramids buildPyramidsFlag() const { return mBuildPyramidsFlag; }

bool deletedFunction() = delete; // some comments

virtual int overriddenProperty() override { return 42; } // if in doubt, comment it out
Expand Down

0 comments on commit 5ccc6cc

Please sign in to comment.