Skip to content
Permalink
Browse files

raster sip fixes

  • Loading branch information
blazek committed Sep 13, 2012
1 parent 94c2e1c commit c6a29fa8a06c21d2e93794d0b0d309252f4aa1dc
@@ -6,7 +6,7 @@
* sense for Raster layers.
*/

class QgsRasterDataProvider : QgsDataProvider
class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
{
%TypeHeaderCode
#include <qgsrasterdataprovider.h>
@@ -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
@@ -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 );

@@ -1,7 +1,7 @@

/** Raster projector */

class QgsRasterProjector
class QgsRasterProjector : QgsRasterInterface
{
%TypeHeaderCode
#include <qgsrasterprojector.h>
@@ -1,4 +1,4 @@
class QgsRasterRenderer
class QgsRasterRenderer : QgsRasterInterface
{
%TypeHeaderCode
#include "qgsrasterrenderer.h"
@@ -7,6 +7,7 @@ class QgsRasterRenderer
#include "qgssinglebandpseudocolorrenderer.h"
#include "qgssinglebandgrayrenderer.h"
#include "qgssinglebandcolordatarenderer.h"
#include "qgsrasterinterface.h"
%End

%ConvertToSubClassCode
@@ -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
@@ -1,7 +1,7 @@

/** Raster resample filter */

class QgsRasterResampleFilter
class QgsRasterResampleFilter : QgsRasterInterface
{
%TypeHeaderCode
#include <qgsrasterresamplefilter.h>
@@ -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

0 comments on commit c6a29fa

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