Skip to content
Permalink
Browse files

+ QgsRasterBlock

  • Loading branch information
blazek committed Oct 11, 2012
1 parent b3dcc3d commit 7cb523a26f38627e1213288e49c88f3664343eea
Showing with 1,771 additions and 1,427 deletions.
  1. +3 −2 python/core/core.sip
  2. +0 −187 python/core/qgsrasterrenderer.sip
  3. +1 −1 python/core/raster/qgsmultibandcolorrenderer.sip
  4. +1 −1 python/core/raster/qgspaletterasterrenderer.sip
  5. +95 −0 python/core/raster/qgsrasterblock.sip
  6. +6 −5 python/core/{ → raster}/qgsrasterdataprovider.sip
  7. +4 −99 python/core/raster/qgsrasterinterface.sip
  8. +2 −2 python/core/raster/qgsrasteriterator.sip
  9. +2 −2 python/core/raster/qgsrasterlayer.sip
  10. +2 −2 python/core/raster/qgsrasternuller.sip
  11. +0 −2 python/core/raster/qgsrasterpipe.sip
  12. +1 −1 python/core/{ → raster}/qgsrasterprojector.sip
  13. +2 −2 python/core/raster/qgsrasterrenderer.sip
  14. +2 −2 python/core/raster/qgsrasterresamplefilter.sip
  15. +1 −1 python/core/raster/qgssinglebandcolordatarenderer.sip
  16. +1 −1 python/core/raster/qgssinglebandgrayrenderer.sip
  17. +1 −1 python/core/raster/qgssinglebandpseudocolorrenderer.sip
  18. +3 −3 src/app/qgisapp.cpp
  19. +15 −15 src/app/qgsrasterlayerproperties.cpp
  20. +2 −0 src/core/CMakeLists.txt
  21. +108 −152 src/core/raster/qgsmultibandcolorrenderer.cpp
  22. +1 −1 src/core/raster/qgsmultibandcolorrenderer.h
  23. +81 −75 src/core/raster/qgspalettedrasterrenderer.cpp
  24. +2 −2 src/core/raster/qgspalettedrasterrenderer.h
  25. +488 −0 src/core/raster/qgsrasterblock.cpp
  26. +415 −0 src/core/raster/qgsrasterblock.h
  27. +1 −1 src/core/raster/qgsrasterchecker.cpp
  28. +41 −35 src/core/raster/qgsrasterdataprovider.cpp
  29. +13 −9 src/core/raster/qgsrasterdataprovider.h
  30. +7 −5 src/core/raster/qgsrasterdrawer.cpp
  31. +46 −44 src/core/raster/qgsrasterfilewriter.cpp
  32. +3 −3 src/core/raster/qgsrasterfilewriter.h
  33. +8 −161 src/core/raster/qgsrasterinterface.cpp
  34. +21 −214 src/core/raster/qgsrasterinterface.h
  35. +8 −4 src/core/raster/qgsrasteriterator.cpp
  36. +4 −1 src/core/raster/qgsrasteriterator.h
  37. +14 −32 src/core/raster/qgsrasterlayer.cpp
  38. +7 −7 src/core/raster/qgsrasterlayer.h
  39. +15 −13 src/core/raster/qgsrasternuller.cpp
  40. +2 −2 src/core/raster/qgsrasternuller.h
  41. +1 −1 src/core/raster/qgsrasterpipe.h
  42. +30 −17 src/core/raster/qgsrasterprojector.cpp
  43. +2 −2 src/core/raster/qgsrasterprojector.h
  44. +7 −4 src/core/raster/qgsrasterrenderer.cpp
  45. +7 −1 src/core/raster/qgsrasterrenderer.h
  46. +48 −27 src/core/raster/qgsrasterresamplefilter.cpp
  47. +2 −2 src/core/raster/qgsrasterresamplefilter.h
  48. +5 −5 src/core/raster/qgsrastertransparency.cpp
  49. +30 −44 src/core/raster/qgssinglebandcolordatarenderer.cpp
  50. +1 −1 src/core/raster/qgssinglebandcolordatarenderer.h
  51. +62 −68 src/core/raster/qgssinglebandgrayrenderer.cpp
  52. +1 −1 src/core/raster/qgssinglebandgrayrenderer.h
  53. +53 −67 src/core/raster/qgssinglebandpseudocolorrenderer.cpp
  54. +1 −1 src/core/raster/qgssinglebandpseudocolorrenderer.h
  55. +7 −7 src/gui/qgsrasterlayersaveasdialog.cpp
  56. +1 −1 src/gui/raster/qgsrasterhistogramwidget.cpp
  57. +2 −2 src/gui/raster/qgssinglebandgrayrendererwidget.cpp
  58. +2 −0 src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp
  59. +24 −27 src/providers/gdal/qgsgdalprovider.cpp
  60. +4 −4 src/providers/gdal/qgsgdalprovider.h
  61. +14 −17 src/providers/gdal/qgsgdalproviderbase.cpp
  62. +1 −1 src/providers/gdal/qgsgdalproviderbase.h
  63. +7 −7 src/providers/grass/qgsgrassrasterprovider.cpp
  64. +2 −2 src/providers/grass/qgsgrassrasterprovider.h
  65. +12 −12 src/providers/wcs/qgswcsprovider.cpp
  66. +2 −2 src/providers/wcs/qgswcsprovider.h
  67. +3 −3 src/providers/wms/qgswmsprovider.cpp
  68. +2 −2 src/providers/wms/qgswmsprovider.h
  69. +9 −9 tests/src/providers/testqgswcspublicservers.cpp
@@ -59,8 +59,6 @@
%Include qgsprovidermetadata.sip
%Include qgsproviderregistry.sip
%Include qgspythonrunner.sip
%Include qgsrasterdataprovider.sip
%Include qgsrasterprojector.sip
%Include qgsrectangle.sip
%Include qgsrenderchecker.sip
%Include qgsrendercontext.sip
@@ -130,14 +128,17 @@
%Include raster/qgslinearminmaxenhancementwithclip.sip
%Include raster/qgspseudocolorshader.sip
%Include raster/qgsrasterbandstats.sip
%Include raster/qgsrasterblock.sip
%Include raster/qgsrasterchecker.sip
%Include raster/qgsrasterdataprovider.sip
%Include raster/qgsrasterfilewriter.sip
%Include raster/qgsrasterhistogram.sip
%Include raster/qgsrasterinterface.sip
%Include raster/qgsrasteriterator.sip
%Include raster/qgsrasterlayer.sip
%Include raster/qgsrasternuller.sip
%Include raster/qgsrasterpipe.sip
%Include raster/qgsrasterprojector.sip
%Include raster/qgsrasterpyramid.sip
%Include raster/qgsrasterrenderer.sip
%Include raster/qgsrasterresamplefilter.sip

This file was deleted.

@@ -12,7 +12,7 @@ class QgsMultiBandColorRenderer: QgsRasterRenderer

static QgsRasterRenderer* create( const QDomElement& elem, QgsRasterDataProvider* provider ) /Factory/;

void * readBlock( int bandNo, const QgsRectangle & extent, int width, int height );
QgsRasterBlock * block( int bandNo, const QgsRectangle & extent, int width, int height ) / Factory /;

int redBand() const;
void setRedBand( int band );
@@ -10,7 +10,7 @@ class QgsPalettedRasterRenderer: QgsRasterRenderer
QgsRasterInterface * clone() /Factory/;
static QgsRasterRenderer* create( const QDomElement& elem, QgsRasterDataProvider* provider ) /Factory/;

void * readBlock( int bandNo, const QgsRectangle & extent, int width, int height );
QgsRasterBlock * block( int bandNo, const QgsRectangle & extent, int width, int height ) / Factory /;

/**Returns number of colors*/
int nColors() const;
@@ -0,0 +1,95 @@
class QgsRasterBlock
{
%TypeHeaderCode
#include <qgsrasterblock.h>
%End

public:

/** Data types.
* This is modified and extended copy of GDALDataType.
*/
enum DataType
{
/*! Unknown or unspecified type */ UnknownDataType = 0,
/*! Eight bit unsigned integer */ Byte = 1,
/*! Sixteen bit unsigned integer */ UInt16 = 2,
/*! Sixteen bit signed integer */ Int16 = 3,
/*! Thirty two bit unsigned integer */ UInt32 = 4,
/*! Thirty two bit signed integer */ Int32 = 5,
/*! Thirty two bit floating point */ Float32 = 6,
/*! Sixty four bit floating point */ Float64 = 7,
/*! Complex Int16 */ CInt16 = 8,
/*! Complex Int32 */ CInt32 = 9,
/*! Complex Float32 */ CFloat32 = 10,
/*! Complex Float64 */ CFloat64 = 11,
/*! Color, alpha, red, green, blue, 4 bytes the same as
QImage::Format_ARGB32 */ ARGB32 = 12,
/*! Color, alpha, red, green, blue, 4 bytes the same as
QImage::Format_ARGB32_Premultiplied */ ARGB32_Premultiplied = 13
};

struct Range
{
double min;
double max;
bool operator==( const QgsRasterBlock::Range &o ) const;
};

QgsRasterBlock();

QgsRasterBlock( DataType theDataType, int theWidth, int theHeight, double theNoDataValue );

virtual ~QgsRasterBlock();

bool reset( DataType theDataType, int theWidth, int theHeight, double theNoDataValue );

bool isEmpty() const;

int typeSize( int dataType ) const;

int dataTypeSize( int bandNo ) const;

/** Returns true if data type is numeric */
bool typeIsNumeric( QgsRasterBlock::DataType type ) const;

/** Returns true if data type is color */
bool typeIsColor( QgsRasterBlock::DataType type ) const;

/** Returns data type for the band specified by number */
virtual QgsRasterBlock::DataType dataType() const;

/** For given data type returns wider type and sets no data value */
static QgsRasterBlock::DataType typeWithNoDataValue( DataType dataType, double *noDataValue );

double noDataValue( ) const;

void setNoDataValue( double noDataValue );

static bool isNoDataValue( double value, double noDataValue );

bool isNoDataValue( double value ) const;

double value( int row, int column ) const;
double value( size_t index) const;
QRgb color( int row, int column ) const;
QRgb color( size_t index) const;
bool isNoData( int row, int column );
bool isNoData( size_t index );
bool setValue( int row, int column, double value );
bool setValue( size_t index, double value );
bool setColor( int row, int column, QRgb color );
bool setColor( size_t index, QRgb color );
// Not desired to give direct access to data in Python, could cause crash
//char * bits( int row, int column );
//char * bits( size_t index );
static QString printValue( double value );

bool convert( QgsRasterBlock::DataType destDataType );
QImage image() const;
bool setImage( const QImage * image );

static bool valueInRange( double value, const QList<QgsRasterBlock::Range> &rangeList );

};

@@ -135,12 +135,12 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
// TODO: Get the file masks supported by this provider, suitable for feeding into the file open dialog box

/** Returns data type for the band specified by number */
virtual QgsRasterInterface::DataType dataType( int bandNo ) const;
virtual QgsRasterBlock::DataType dataType( int bandNo ) const;

/** Returns source data type for the band specified by number,
* source data type may be shorter than dataType
*/
virtual QgsRasterInterface::DataType srcDataType( int bandNo ) const;
virtual QgsRasterBlock::DataType srcDataType( int bandNo ) const;

/** Returns data type for the band specified by number */
virtual int colorInterpretation( int theBandNo ) const;
@@ -172,6 +172,7 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface

/** Read block of data using given extent and size. */
// virtual void *readBlock( int bandNo, QgsRectangle const & extent, int width, int height );
virtual QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height ) / Factory /;

/* Read a value from a data block at a given index. */
virtual double readValue( void *data, int type, int index );
@@ -196,10 +197,10 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
/** Value representing no data value. */
virtual double srcNoDataValue( int bandNo ) const;

virtual void setUserNoDataValue( int bandNo, QList<QgsRasterInterface::Range> noData );
virtual void setUserNoDataValue( int bandNo, QList<QgsRasterBlock::Range> noData );

/** Get list of user no data value ranges */
virtual QList<QgsRasterInterface::Range> userNoDataValue( int bandNo ) const;
virtual QList<QgsRasterBlock::Range> userNoDataValue( int bandNo ) const;

virtual double minimumValue( int bandNo ) const;
virtual double maximumValue( int bandNo ) const;
@@ -403,7 +404,7 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
/** Creates a new dataset with mDataSourceURI
@return true in case of success*/
virtual bool create( const QString& format, int nBands,
QgsRasterInterface::DataType type,
QgsRasterBlock::DataType type,
int width, int height, double* geoTransform,
const QgsCoordinateReferenceSystem& crs,
QStringList createOptions = QStringList() /*e.v. color table*/ );

0 comments on commit 7cb523a

Please sign in to comment.
You can’t perform that action at this time.