Skip to content

Commit

Permalink
add missing ConvertToSubClass sections
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed May 31, 2017
1 parent 7e52f06 commit 52a8be6
Show file tree
Hide file tree
Showing 11 changed files with 343 additions and 0 deletions.
81 changes: 81 additions & 0 deletions src/core/composer/qgscomposeritem.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,88 @@ class QgsComposerEffect;
* A item that forms part of a map composition.
*/
class CORE_EXPORT QgsComposerItem: public QgsComposerObject, public QGraphicsRectItem
#ifdef SIP_RUN
#include <qgscomposerarrow.h>
#include <qgscomposerframe.h>
#include <qgscomposeritemgroup.h>
#include <qgscomposerlabel.h>
#include <qgscomposerlegend.h>
#include <qgscomposermap.h>
#include <qgspaperitem.h>
#include <qgscomposerpicture.h>
#include <qgscomposerscalebar.h>
#include <qgscomposershape.h>
#include <qgscomposerpolygon.h>
#include <qgscomposerpolyline.h>
#include <qgscomposertexttable.h>
#endif
{

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
// the conversions have to be static, because they're using multiple inheritance
// (seen in PyQt4 .sip files for some QGraphicsItem classes)
switch ( sipCpp->type() )
{
case QgsComposerItem::ComposerItem:
sipType = sipType_QgsComposerItem;
*sipCppRet = static_cast<QgsComposerItem *>( sipCpp );
break;
case QgsComposerItem::ComposerArrow:
sipType = sipType_QgsComposerArrow;
*sipCppRet = static_cast<QgsComposerArrow *>( sipCpp );
break;
case QgsComposerItem::ComposerItemGroup:
sipType = sipType_QgsComposerItemGroup;
*sipCppRet = static_cast<QgsComposerItemGroup *>( sipCpp );
break;
case QgsComposerItem::ComposerLabel:
sipType = sipType_QgsComposerLabel;
*sipCppRet = static_cast<QgsComposerLabel *>( sipCpp );
break;
case QgsComposerItem::ComposerLegend:
sipType = sipType_QgsComposerLegend;
*sipCppRet = static_cast<QgsComposerLegend *>( sipCpp );
break;
case QgsComposerItem::ComposerMap:
sipType = sipType_QgsComposerMap;
*sipCppRet = static_cast<QgsComposerMap *>( sipCpp );
break;
case QgsComposerItem::ComposerPaper:
sipType = sipType_QgsPaperItem;
*sipCppRet = static_cast<QgsPaperItem *>( sipCpp );
break;
case QgsComposerItem::ComposerPicture:
sipType = sipType_QgsComposerPicture;
*sipCppRet = static_cast<QgsComposerPicture *>( sipCpp );
break;
case QgsComposerItem::ComposerScaleBar:
sipType = sipType_QgsComposerScaleBar;
*sipCppRet = static_cast<QgsComposerScaleBar *>( sipCpp );
break;
case QgsComposerItem::ComposerShape:
sipType = sipType_QgsComposerShape;
*sipCppRet = static_cast<QgsComposerShape *>( sipCpp );
break;
case QgsComposerItem::ComposerPolygon:
sipType = sipType_QgsComposerPolygon;
*sipCppRet = static_cast<QgsComposerPolygon *>( sipCpp );
break;
case QgsComposerItem::ComposerPolyline:
sipType = sipType_QgsComposerPolyline;
*sipCppRet = static_cast<QgsComposerPolyline *>( sipCpp );
break;
case QgsComposerItem::ComposerFrame:
sipType = sipType_QgsComposerFrame;
*sipCppRet = static_cast<QgsComposerFrame *>( sipCpp );
break;
default:
sipType = 0;
}
SIP_END
#endif


Q_OBJECT
public:

Expand Down
16 changes: 16 additions & 0 deletions src/core/composer/qgscomposermultiframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@ class QPainter;

class CORE_EXPORT QgsComposerMultiFrame: public QgsComposerObject
{

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( dynamic_cast<QgsComposerHtml *>( sipCpp ) != NULL )
sipType = sipType_QgsComposerHtml;
else if ( dynamic_cast<QgsComposerAttributeTableV2 *>( sipCpp ) != NULL )
sipType = sipType_QgsComposerAttributeTableV2;
else if ( dynamic_cast<QgsComposerTableV2 *>( sipCpp ) != NULL )
sipType = sipType_QgsComposerTableV2;
else if ( dynamic_cast<QgsComposerMultiFrame *>( sipCpp ) != NULL )
sipType = sipType_QgsComposerMultiFrame;
else
sipType = NULL;
SIP_END
#endif

Q_OBJECT

public:
Expand Down
16 changes: 16 additions & 0 deletions src/core/gps/qgsgpsconnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,23 @@ struct CORE_EXPORT QgsGPSInformation
/** \ingroup core
* Abstract base class for connection to a GPS device*/
class CORE_EXPORT QgsGPSConnection : public QObject
#ifdef SIP_RUN
#include <qgsgpsdconnection.h>
#include <qgsnmeaconnection.h>
#endif
{

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( sipCpp->inherits( "QgsGpsdConnection" ) )
sipType = sipType_QgsGpsdConnection;
else if ( sipCpp->inherits( "QgsNMEAConnection" ) )
sipType = sipType_QgsNMEAConnection;
else
sipType = NULL;
SIP_END
#endif

Q_OBJECT
public:

Expand Down
60 changes: 60 additions & 0 deletions src/core/raster/qgsrasterinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,67 @@ class CORE_EXPORT QgsRasterBlockFeedback : public QgsFeedback
* Base class for processing filters like renderers, reprojector, resampler etc.
*/
class CORE_EXPORT QgsRasterInterface
#ifdef SIP_RUN
// QgsRasterInterface subclasses
#include <qgsbrightnesscontrastfilter.h>
#include <qgshuesaturationfilter.h>
#include <qgsrasterdataprovider.h>
#include <qgsrasternuller.h>
#include <qgsrasterprojector.h>
#include <qgsrasterrenderer.h>
#include <qgsrasterresamplefilter.h>

// QgsRasterRenderer subclasses
#include <qgshillshaderenderer.h>
#include <qgsmultibandcolorrenderer.h>
#include <qgspalettedrasterrenderer.h>
#include <qgssinglebandcolordatarenderer.h>
#include <qgssinglebandgrayrenderer.h>
#include <qgssinglebandpseudocolorrenderer.h>
#endif
{

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( dynamic_cast<QgsBrightnessContrastFilter *>( sipCpp ) )
sipType = sipType_QgsBrightnessContrastFilter;
else if ( dynamic_cast<QgsHueSaturationFilter *>( sipCpp ) )
sipType = sipType_QgsHueSaturationFilter;
else if ( dynamic_cast<QgsRasterDataProvider *>( sipCpp ) )
{
sipType = sipType_QgsRasterDataProvider;
// use static cast because QgsRasterDataProvider has multiple inheritance
// and we would end up with bad pointer otherwise!
*sipCppRet = static_cast<QgsRasterDataProvider *>( sipCpp );
}
else if ( dynamic_cast<QgsRasterNuller *>( sipCpp ) )
sipType = sipType_QgsRasterNuller;
else if ( dynamic_cast<QgsRasterProjector *>( sipCpp ) )
sipType = sipType_QgsRasterProjector;
else if ( dynamic_cast<QgsRasterRenderer *>( sipCpp ) )
{
if ( dynamic_cast<QgsHillshadeRenderer *>( sipCpp ) )
sipType = sipType_QgsHillshadeRenderer;
else if ( dynamic_cast<QgsMultiBandColorRenderer *>( sipCpp ) )
sipType = sipType_QgsMultiBandColorRenderer;
else if ( dynamic_cast<QgsPalettedRasterRenderer *>( sipCpp ) )
sipType = sipType_QgsPalettedRasterRenderer;
else if ( dynamic_cast<QgsSingleBandColorDataRenderer *>( sipCpp ) )
sipType = sipType_QgsSingleBandColorDataRenderer;
else if ( dynamic_cast<QgsSingleBandGrayRenderer *>( sipCpp ) )
sipType = sipType_QgsSingleBandGrayRenderer;
else if ( dynamic_cast<QgsSingleBandPseudoColorRenderer *>( sipCpp ) )
sipType = sipType_QgsSingleBandPseudoColorRenderer;
else
sipType = sipType_QgsRasterRenderer;
}
else if ( dynamic_cast<QgsRasterResampleFilter *>( sipCpp ) )
sipType = sipType_QgsRasterResampleFilter;
else
sipType = 0;
SIP_END
#endif

Q_DECLARE_TR_FUNCTIONS( QgsRasterInterface )

public:
Expand Down
16 changes: 16 additions & 0 deletions src/core/raster/qgsrasterresampler.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,23 @@ class QImage;
* Interface for resampling rasters (e.g. to have a smoother appearance)
*/
class QgsRasterResampler
#ifdef SIP_RUN
#include "qgsbilinearrasterresampler.h"
#include "qgscubicrasterresampler.h"
#endif
{

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( dynamic_cast<QgsBilinearRasterResampler *>( sipCpp ) != NULL )
sipType = sipType_QgsBilinearRasterResampler;
else if ( dynamic_cast<QgsCubicRasterResampler *>( sipCpp ) != NULL )
sipType = sipType_QgsCubicRasterResampler;
else
sipType = 0;
SIP_END
#endif

public:
virtual ~QgsRasterResampler() = default;
virtual void resample( const QImage &srcImage, QImage &dstImage ) = 0;
Expand Down
12 changes: 12 additions & 0 deletions src/core/raster/qgsrastershaderfunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,20 @@ email : ersts@amnh.org
#include <QPair>

class CORE_EXPORT QgsRasterShaderFunction
#ifdef SIP_RUN
#include <qgscolorrampshader.h>
#endif
{

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( dynamic_cast<QgsColorRampShader *>( sipCpp ) != NULL )
sipType = sipType_QgsColorRampShader;
else
sipType = 0;
SIP_END
#endif

public:
QgsRasterShaderFunction( double minimumValue = 0.0, double maximumValue = 255.0 );
virtual ~QgsRasterShaderFunction() = default;
Expand Down
28 changes: 28 additions & 0 deletions src/core/symbology-ng/qgsrenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,34 @@ typedef QList< QgsSymbolLevel > QgsSymbolLevelOrder;
*/
class CORE_EXPORT QgsFeatureRenderer
{

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( sipCpp->type() == "singleSymbol" )
sipType = sipType_QgsSingleSymbolRenderer;
else if ( sipCpp->type() == "categorizedSymbol" )
sipType = sipType_QgsCategorizedSymbolRenderer;
else if ( sipCpp->type() == "graduatedSymbol" )
sipType = sipType_QgsGraduatedSymbolRenderer;
else if ( sipCpp->type() == "RuleRenderer" )
sipType = sipType_QgsRuleBasedRenderer;
else if ( sipCpp->type() == "heatmapRenderer" )
sipType = sipType_QgsHeatmapRenderer;
else if ( sipCpp->type() == "invertedPolygonRenderer" )
sipType = sipType_QgsInvertedPolygonRenderer;
else if ( sipCpp->type() == "pointCluster" )
sipType = sipType_QgsPointClusterRenderer;
else if ( sipCpp->type() == "pointDisplacement" )
sipType = sipType_QgsPointDisplacementRenderer;
else if ( sipCpp->type() == "25dRenderer" )
sipType = sipType_Qgs25DRenderer;
else if ( sipCpp->type() == "nullSymbol" )
sipType = sipType_QgsNullSymbolRenderer;
else
sipType = 0;
SIP_END
#endif

public:
// renderer takes ownership of its symbols!

Expand Down
13 changes: 13 additions & 0 deletions src/core/symbology-ng/qgssymbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ typedef QList<QgsSymbolLayer *> QgsSymbolLayerList;
*/
class CORE_EXPORT QgsSymbol
{

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
switch ( sipCpp->type() )
{
case QgsSymbol::Marker: sipType = sipType_QgsMarkerSymbol; break;
case QgsSymbol::Line: sipType = sipType_QgsLineSymbol; break;
case QgsSymbol::Fill: sipType = sipType_QgsFillSymbol; break;
default: sipType = 0; break;
}
SIP_END
#endif

friend class QgsFeatureRenderer;

public:
Expand Down
63 changes: 63 additions & 0 deletions src/core/symbology-ng/qgssymbollayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,70 @@ class QgsPaintEffect;
* \class QgsSymbolLayer
*/
class CORE_EXPORT QgsSymbolLayer
#ifdef SIP_RUN
#include <qgslinesymbollayer.h>
#endif
{

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
switch ( sipCpp->type() )
{
case QgsSymbol::Marker:
if ( sipCpp->layerType() == "EllipseMarker" )
sipType = sipType_QgsEllipseSymbolLayer;
else if ( sipCpp->layerType() == "FontMarker" )
sipType = sipType_QgsFontMarkerSymbolLayer;
else if ( sipCpp->layerType() == "SimpleMarker" )
sipType = sipType_QgsSimpleMarkerSymbolLayer;
else if ( sipCpp->layerType() == "FilledMarker" )
sipType = sipType_QgsFilledMarkerSymbolLayer;
else if ( sipCpp->layerType() == "SvgMarker" )
sipType = sipType_QgsSvgMarkerSymbolLayer;
else if ( sipCpp->layerType() == "VectorField" )
sipType = sipType_QgsVectorFieldSymbolLayer;
else
sipType = sipType_QgsMarkerSymbolLayer;
break;

case QgsSymbol::Line:
if ( sipCpp->layerType() == "MarkerLine" )
sipType = sipType_QgsMarkerLineSymbolLayer;
else if ( sipCpp->layerType() == "SimpleLine" )
sipType = sipType_QgsSimpleLineSymbolLayer;
else if ( sipCpp->layerType() == "ArrowLine" )
sipType = sipType_QgsArrowSymbolLayer;
else
sipType = sipType_QgsLineSymbolLayer;
break;

case QgsSymbol::Fill:
if ( sipCpp->layerType() == "SimpleFill" )
sipType = sipType_QgsSimpleFillSymbolLayer;
else if ( sipCpp->layerType() == "LinePatternFill" )
sipType = sipType_QgsLinePatternFillSymbolLayer;
else if ( sipCpp->layerType() == "PointPatternFill" )
sipType = sipType_QgsPointPatternFillSymbolLayer;
else if ( sipCpp->layerType() == "SVGFill" )
sipType = sipType_QgsSVGFillSymbolLayer;
else if ( sipCpp->layerType() == "RasterFill" )
sipType = sipType_QgsRasterFillSymbolLayer;
else if ( sipCpp->layerType() == "CentroidFill" )
sipType = sipType_QgsCentroidFillSymbolLayer;
else if ( sipCpp->layerType() == "GradientFill" )
sipType = sipType_QgsGradientFillSymbolLayer;
else if ( sipCpp->layerType() == "ShapeburstFill" )
sipType = sipType_QgsShapeburstFillSymbolLayer;
else
sipType = sipType_QgsFillSymbolLayer;
break;

case QgsSymbol::Hybrid:
sipType = sipType_QgsGeometryGeneratorSymbolLayer;
break;
}
SIP_END
#endif
public:

/**
Expand Down
11 changes: 11 additions & 0 deletions src/gui/layertree/qgslayertreeview.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ class QgsMapLayer;
*/
class GUI_EXPORT QgsLayerTreeView : public QTreeView
{

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( sipCpp->inherits( "QgsLayerTreeView" ) )
sipType = sipType_QgsLayerTreeView;
else
sipType = 0;
SIP_END
#endif


Q_OBJECT
public:
explicit QgsLayerTreeView( QWidget *parent SIP_TRANSFERTHIS = 0 );
Expand Down
Loading

0 comments on commit 52a8be6

Please sign in to comment.