Skip to content

Commit

Permalink
Merge branch 'master' of github.com:qgis/Quantum-GIS
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennesky committed Sep 6, 2012
2 parents 0d189ff + ea86b93 commit 8074edc
Show file tree
Hide file tree
Showing 15 changed files with 432 additions and 66 deletions.
5 changes: 5 additions & 0 deletions python/core/core.sip
Expand Up @@ -63,10 +63,15 @@
%Include qgsproviderregistry.sip
%Include qgsrasterbandstats.sip
%Include qgsrasterdataprovider.sip
%Include qgsrasterchecker.sip
%Include qgsrasterfilewriter.sip
%Include qgsrasterinterface.sip
%Include qgsrasterlayer.sip
%Include qgsrasterpipe.sip
%Include qgsrasterpyramid.sip
%Include qgsrasterprojector.sip
%Include qgsrasterrenderer.sip
%Include qgsrasterresamplefilter.sip
%Include qgsrasterresampler.sip
%Include qgsrastershader.sip
%Include qgsrastershaderfunction.sip
Expand Down
20 changes: 20 additions & 0 deletions python/core/qgsrasterchecker.sip
@@ -0,0 +1,20 @@

/** Raster checker for tests in python */

class QgsRasterChecker
{
%TypeHeaderCode
#include <qgsrasterchecker.h>
%End
public:

QgsRasterChecker();

~QgsRasterChecker();

QString report();

bool runTest( QString theVerifiedKey, QString theVerifiedUri,
QString theExpectedKey, QString theExpectedUri );
};

66 changes: 63 additions & 3 deletions python/core/qgsrasterdataprovider.sip
Expand Up @@ -18,11 +18,63 @@ class QgsRasterDataProvider : QgsDataProvider
//! If you add to this, please also add to capabilitiesString()
enum Capability
{
NoCapabilities = 0,
Identify = 1
// Capability2 = 1 << 1, etc
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();

Expand Down Expand Up @@ -179,6 +231,14 @@ class QgsRasterDataProvider : QgsDataProvider
@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,
Expand Down
56 changes: 56 additions & 0 deletions python/core/qgsrasterfilewriter.sip
@@ -0,0 +1,56 @@

/** Raster file writer */

class QgsRasterFileWriter
{
%TypeHeaderCode
#include <qgsrasterfilewriter.h>
#include <qgsrasterdataprovider.h>
%End
public:
enum WriterError
{
NoError = 0,
SourceProviderError = 1,
DestProviderError = 2,
CreateDatasourceError = 3,
WriteError = 4,
NoDataConflict = 5
};

QgsRasterFileWriter( const QString& outputUrl );
~QgsRasterFileWriter();
WriterError writeRaster( const QgsRasterPipe* pipe, int nCols, int nRows, QgsRectangle outputExtent,
const QgsCoordinateReferenceSystem& crs, QProgressDialog* p = 0 );

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;

QgsRasterDataProvider::RasterBuildPyramids buildPyramidsFlag() const;
void setBuildPyramidsFlag( QgsRasterDataProvider::RasterBuildPyramids f );

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

QString pyramidsResampling() const;
void setPyramidsResampling( const QString & str );

QgsRasterDataProvider::RasterPyramidsFormat pyramidsFormat() const;
void setPyramidsFormat( QgsRasterDataProvider::RasterPyramidsFormat f );

void setMaxTileHeight( int h );
int maxTileHeight() const;

void setCreateOptions( const QStringList& list );
QStringList createOptions() const;
};

51 changes: 51 additions & 0 deletions python/core/qgsrasterpipe.sip
@@ -0,0 +1,51 @@

/** Raster pipe */

class QgsRasterPipe
{
%TypeHeaderCode
#include <qgsrasterpipe.h>
#include <qgsrasterresamplefilter.h>
#include <qgsrasterprojector.h>
%End
public:
enum Role
{
UnknownRole = 0,
ProviderRole = 1,
RendererRole = 2,
ResamplerRole = 3,
ProjectorRole = 4
};

QgsRasterPipe();
QgsRasterPipe( const QgsRasterPipe& thePipe );

~QgsRasterPipe();

bool insert( int idx, QgsRasterInterface* theInterface );

bool replace( int idx, QgsRasterInterface* theInterface );

bool set( QgsRasterInterface * theInterface );

bool remove( int idx );

bool remove( QgsRasterInterface * theInterface );

int size() const;
QgsRasterInterface * at( int idx ) const;
QgsRasterInterface * last() const;

bool setOn( int idx, bool on );

bool canSetOn( int idx, bool on );

QgsRasterDataProvider * provider() const;
QgsRasterRenderer * renderer() const;
QgsRasterResampleFilter * resampleFilter() const;
QgsRasterProjector * projector() const;

void setStatsOn( bool on );
};

57 changes: 57 additions & 0 deletions python/core/qgsrasterprojector.sip
@@ -0,0 +1,57 @@

/** Raster projector */

class QgsRasterProjector
{
%TypeHeaderCode
#include <qgsrasterprojector.h>
#include <qgscoordinatereferencesystem.h>
%End
public:
QgsRasterProjector(
QgsCoordinateReferenceSystem theSrcCRS,
QgsCoordinateReferenceSystem theDestCRS,
QgsRectangle theDestExtent,
int theDestRows, int theDestCols,
double theMaxSrcXRes, double theMaxSrcYRes,
QgsRectangle theExtent
);
QgsRasterProjector(
QgsCoordinateReferenceSystem theSrcCRS,
QgsCoordinateReferenceSystem theDestCRS,
double theMaxSrcXRes, double theMaxSrcYRes,
QgsRectangle theExtent
);
QgsRasterProjector();

~QgsRasterProjector();

QgsRasterInterface * clone() const;

int bandCount() const;

QgsRasterInterface::DataType dataType( int bandNo ) const;

void setCRS( const QgsCoordinateReferenceSystem & theSrcCRS, const QgsCoordinateReferenceSystem & theDestCRS );

QgsCoordinateReferenceSystem srcCrs() const;

QgsCoordinateReferenceSystem destCrs() const;

void setMaxSrcRes( double theMaxSrcXRes, double theMaxSrcYRes );

QgsRectangle srcExtent();

int srcRows();
int srcCols();
void setSrcRows( int theRows );
void setSrcCols( int theCols );

void srcRowCol( int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol );

int dstRows() const;
int dstCols() const;

void * readBlock( int bandNo, const QgsRectangle & extent, int width, int height );
};

26 changes: 17 additions & 9 deletions python/core/qgsrasterresamplefilter.sip
@@ -1,29 +1,37 @@

/** Raster resample filter */

class QgsRasterResampleFilter
{
%TypeHeaderCode
#include "qgsrasterresamplefilter.h"
#include <qgsrasterresamplefilter.h>
%End
QgsRasterResampleFilter();
QgsRasterResampleFilter( const QgsRasterResampleFilter& thePipe );

public:
QgsRasterResampleFilter( QgsRasterFace* input = 0 );
~QgsRasterResampleFilter();

QgsRasterInterface * clone() const;

int bandCount() const;

QgsRasterInterface::DataType dataType( int bandNo ) const;

bool setInput( QgsRasterInterface* input );

void * readBlock( int bandNo, const QgsRectangle & extent, int width, int height );

/**Set resampler for zoomed in scales. Takes ownership of the object*/
void setZoomedInResampler( QgsRasterResampler* r );
const QgsRasterResampler* zoomedInResampler();
const QgsRasterResampler* zoomedInResampler() const;

/**Set resampler for zoomed out scales. Takes ownership of the object*/
void setZoomedOutResampler( QgsRasterResampler* r );
const QgsRasterResampler* zoomedOutResampler() const;

void setMaxOversampling( double os );
double maxOversampling() const;

virtual void writeXML( QDomDocument& doc, QDomElement& parentElem ) const = 0;
void writeXML( QDomDocument& doc, QDomElement& parentElem );

/**Sets base class members from xml. Usually called from create() methods of subclasses*/
void readXML( const QDomElement& rendererElem );
void readXML( const QDomElement& resamplefilterElem );
};

28 changes: 27 additions & 1 deletion src/core/qgsrasterprojector.cpp
Expand Up @@ -66,6 +66,32 @@ QgsRasterProjector::QgsRasterProjector()
QgsDebugMsg( "Entered" );
}

QgsRasterProjector::QgsRasterProjector( const QgsRasterProjector &projector )
{
mSrcCRS = projector.mSrcCRS;
mDestCRS = projector.mDestCRS;
mMaxSrcXRes = projector.mMaxSrcXRes;
mMaxSrcYRes = projector.mMaxSrcYRes;
mExtent = projector.mExtent;
mCoordinateTransform.setSourceCrs( mSrcCRS );
mCoordinateTransform.setDestCRS( mDestCRS );
}

QgsRasterProjector & QgsRasterProjector::operator=( const QgsRasterProjector & projector )
{
if ( &projector != this )
{
mSrcCRS = projector.mSrcCRS;
mDestCRS = projector.mDestCRS;
mMaxSrcXRes = projector.mMaxSrcXRes;
mMaxSrcYRes = projector.mMaxSrcYRes;
mExtent = projector.mExtent;
mCoordinateTransform.setSourceCrs( mSrcCRS );
mCoordinateTransform.setDestCRS( mDestCRS );
}
return *this;
}

QgsRasterInterface * QgsRasterProjector::clone() const
{
QgsDebugMsg( "Entered" );
Expand Down Expand Up @@ -93,7 +119,7 @@ QgsRasterInterface::DataType QgsRasterProjector::dataType( int bandNo ) const
return QgsRasterInterface::UnknownDataType;
}

void QgsRasterProjector::setCRS( QgsCoordinateReferenceSystem theSrcCRS, QgsCoordinateReferenceSystem theDestCRS )
void QgsRasterProjector::setCRS( const QgsCoordinateReferenceSystem & theSrcCRS, const QgsCoordinateReferenceSystem & theDestCRS )
{
mSrcCRS = theSrcCRS;
mDestCRS = theDestCRS;
Expand Down

0 comments on commit 8074edc

Please sign in to comment.