Skip to content
Permalink
Browse files

Fixed SIP wrapper for conversion to QgsRasterInterface subclasses

  • Loading branch information
wonder-sk committed Oct 22, 2014
1 parent da98a3c commit 6db04b41f93236d13b9cbcc2ec6ca11c64486cee
Showing with 37 additions and 41 deletions.
  1. +36 −19 python/core/raster/qgsrasterinterface.sip
  2. +1 −22 python/core/raster/qgsrasterrenderer.sip
@@ -7,35 +7,52 @@ class QgsRasterInterface
{
%TypeHeaderCode
#include <qgsrasterinterface.h>
#include <qgsrasterresamplefilter.h>
//#include <qgsrasternuller.h>
#include <qgsrasterrenderer.h>
#include <qgsrasterprojector.h>

// QgsRasterInterface subclasses
#include <qgsbrightnesscontrastfilter.h>
#include <qgshuesaturationfilter.h>
#include <qgsrasterdataprovider.h>
#include <qgsrasternuller.h>
#include <qgsrasterprojector.h>
#include <qgsrasterrenderer.h>
#include <qgsrasterresamplefilter.h>

// QgsRasterRenderer subclass headers must be here because ConvertToSubClassCode
// from QgsRasterRenderer is probably included
#include <qgspalettedrasterrenderer.h>
// QgsRasterRenderer subclasses
#include <qgsmultibandcolorrenderer.h>
#include <qgssinglebandpseudocolorrenderer.h>
#include <qgssinglebandgrayrenderer.h>
#include <qgspalettedrasterrenderer.h>
#include <qgssinglebandcolordatarenderer.h>
#include <qgssinglebandgrayrenderer.h>
#include <qgssinglebandpseudocolorrenderer.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)
if ( dynamic_cast<QgsBrightnessContrastFilter*>(sipCpp))
sipClass = sipClass_QgsBrightnessContrastFilter;
else if (dynamic_cast<QgsHueSaturationFilter*>(sipCpp))
sipClass = sipClass_QgsHueSaturationFilter;
else if (dynamic_cast<QgsRasterDataProvider*>(sipCpp))
sipClass = sipClass_QgsRasterDataProvider;
else if (dynamic_cast<QgsRasterNuller*>(sipCpp))
sipClass = sipClass_QgsRasterNuller;
else if (dynamic_cast<QgsRasterProjector*>(sipCpp))
sipClass = sipClass_QgsRasterProjector;
if (dynamic_cast<QgsRasterDataProvider*>(sipCpp) != NULL)
else if (dynamic_cast<QgsRasterRenderer*>(sipCpp))
{
sipClass = sipClass_QgsRasterDataProvider;
*sipCppRet = static_cast<QgsRasterDataProvider*>(sipCpp);
if ( dynamic_cast<QgsMultiBandColorRenderer*>(sipCpp))
sipClass = sipClass_QgsMultiBandColorRenderer;
else if (dynamic_cast<QgsPalettedRasterRenderer*>(sipCpp))
sipClass = sipClass_QgsPalettedRasterRenderer;
else if (dynamic_cast<QgsSingleBandColorDataRenderer*>(sipCpp))
sipClass = sipClass_QgsSingleBandColorDataRenderer;
else if (dynamic_cast<QgsSingleBandGrayRenderer*>(sipCpp))
sipClass = sipClass_QgsSingleBandGrayRenderer;
else if (dynamic_cast<QgsSingleBandPseudoColorRenderer*>(sipCpp))
sipClass = sipClass_QgsSingleBandPseudoColorRenderer;
else
sipClass = sipClass_QgsRasterRenderer;
}
else if (dynamic_cast<QgsRasterResampleFilter*>(sipCpp))
sipClass = sipClass_QgsRasterResampleFilter;
else
sipClass = 0;
%End
@@ -2,28 +2,7 @@
class QgsRasterRenderer : QgsRasterInterface
{
%TypeHeaderCode
#include "qgsrasterrenderer.h"
#include "qgspalettedrasterrenderer.h"
#include "qgsmultibandcolorrenderer.h"
#include "qgssinglebandpseudocolorrenderer.h"
#include "qgssinglebandgrayrenderer.h"
#include "qgssinglebandcolordatarenderer.h"
#include "qgsrasterinterface.h"
%End

%ConvertToSubClassCode
if (dynamic_cast<QgsPalettedRasterRenderer*>(sipCpp) != NULL)
sipClass = sipClass_QgsPalettedRasterRenderer;
else if (dynamic_cast<QgsMultiBandColorRenderer*>(sipCpp) != NULL)
sipClass = sipClass_QgsMultiBandColorRenderer;
else if (dynamic_cast<QgsSingleBandPseudoColorRenderer*>(sipCpp) != NULL)
sipClass = sipClass_QgsSingleBandPseudoColorRenderer;
else if (dynamic_cast<QgsSingleBandGrayRenderer*>(sipCpp) != NULL)
sipClass = sipClass_QgsSingleBandGrayRenderer;
else if (dynamic_cast<QgsSingleBandGrayRenderer*>(sipCpp) != NULL)
sipClass = sipClass_QgsSingleBandGrayRenderer;
else
sipClass = 0;
#include "qgsrasterrenderer.h"
%End

public:

0 comments on commit 6db04b4

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