Skip to content

Commit

Permalink
raster sip fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Sep 13, 2012
1 parent 94c2e1c commit c6a29fa
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 10 deletions.
2 changes: 1 addition & 1 deletion python/core/qgsrasterdataprovider.sip
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* sense for Raster layers.
*/

class QgsRasterDataProvider : QgsDataProvider
class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
{
%TypeHeaderCode
#include <qgsrasterdataprovider.h>
Expand Down
32 changes: 32 additions & 0 deletions python/core/qgsrasterinterface.sip
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,39 @@ class QgsRasterInterface
{
%TypeHeaderCode
#include <qgsrasterinterface.h>
#include <qgsrasterresamplefilter.h>
//#include <qgsrasternuller.h>
#include <qgsrasterrenderer.h>
#include <qgsrasterprojector.h>
#include <qgsrasterdataprovider.h>

// QgsRasterRenderer subclass headers must be here because ConvertToSubClassCode
// from QgsRasterRenderer is probably included
#include <qgspalettedrasterrenderer.h>
#include <qgsmultibandcolorrenderer.h>
#include <qgssinglebandpseudocolorrenderer.h>
#include <qgssinglebandgrayrenderer.h>
#include <qgssinglebandcolordatarenderer.h>
%End

%ConvertToSubClassCode
if (dynamic_cast<QgsRasterResampleFilter*>(sipCpp) != NULL)
sipClass = sipClass_QgsRasterResampleFilter;
// if (dynamic_cast<QgsRasterNuller*>(sipCpp) != NULL)
// sipClass = sipClass_QgsRasterNuller;
if (dynamic_cast<QgsRasterRenderer*>(sipCpp) != NULL)
sipClass = sipClass_QgsRasterRenderer;
if (dynamic_cast<QgsRasterProjector*>(sipCpp) != NULL)
sipClass = sipClass_QgsRasterProjector;
if (dynamic_cast<QgsRasterDataProvider*>(sipCpp) != NULL)
{
sipClass = sipClass_QgsRasterDataProvider;
*sipCppRet = static_cast<QgsRasterDataProvider*>(sipCpp);
}
else
sipClass = 0;
%End

public:

enum DataType
Expand Down
6 changes: 3 additions & 3 deletions python/core/qgsrasterpipe.sip
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ class QgsRasterPipe

~QgsRasterPipe();

bool insert( int idx, QgsRasterInterface* theInterface );
bool insert( int idx, QgsRasterInterface* theInterface /Transfer/ );

bool replace( int idx, QgsRasterInterface* theInterface );
bool replace( int idx, QgsRasterInterface* theInterface /Transfer/ );

bool set( QgsRasterInterface * theInterface );
bool set( QgsRasterInterface * theInterface /Transfer/ );

bool remove( int idx );

Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsrasterprojector.sip
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

/** Raster projector */

class QgsRasterProjector
class QgsRasterProjector : QgsRasterInterface
{
%TypeHeaderCode
#include <qgsrasterprojector.h>
Expand Down
7 changes: 4 additions & 3 deletions python/core/qgsrasterrenderer.sip
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class QgsRasterRenderer
class QgsRasterRenderer : QgsRasterInterface
{
%TypeHeaderCode
#include "qgsrasterrenderer.h"
Expand All @@ -7,6 +7,7 @@ class QgsRasterRenderer
#include "qgssinglebandpseudocolorrenderer.h"
#include "qgssinglebandgrayrenderer.h"
#include "qgssinglebandcolordatarenderer.h"
#include "qgsrasterinterface.h"
%End

%ConvertToSubClassCode
Expand All @@ -18,8 +19,8 @@ class QgsRasterRenderer
sipClass = sipClass_QgsSingleBandPseudoColorRenderer;
else if (dynamic_cast<QgsSingleBandGrayRenderer*>(sipCpp) != NULL)
sipClass = sipClass_QgsSingleBandGrayRenderer;
else if (dynamic_cast<QgsSingleBandGrayRenderer*>(sipCpp) != NULL)
sipClass = sipClass_QgsSingleBandGrayRenderer;
else if (dynamic_cast<QgsSingleBandGrayRenderer*>(sipCpp) != NULL)
sipClass = sipClass_QgsSingleBandGrayRenderer;
else
sipClass = 0;
%End
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsrasterresamplefilter.sip
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

/** Raster resample filter */

class QgsRasterResampleFilter
class QgsRasterResampleFilter : QgsRasterInterface
{
%TypeHeaderCode
#include <qgsrasterresamplefilter.h>
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgsrasterfilewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def write(self, theRasterName):

projector = QgsRasterProjector()
projector.setCRS( provider.crs(), provider.crs() )
if not pipe.insert( 2, projector.clone() ):
if not pipe.insert( 2, projector ):
print "Cannot set pipe projector"
return False

Expand Down

0 comments on commit c6a29fa

Please sign in to comment.