Skip to content

Commit

Permalink
fix #30766, sip crash for QgsHighlight
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik authored and nyalldawson committed Sep 13, 2019
1 parent 0d26d64 commit cdd3a55
Show file tree
Hide file tree
Showing 12 changed files with 169 additions and 7 deletions.
11 changes: 11 additions & 0 deletions python/gui/auto_generated/qgsadvanceddigitizingcanvasitem.sip.in
Expand Up @@ -11,6 +11,11 @@



%ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgsadvanceddigitizingcanvasitem.h>
%End

class QgsAdvancedDigitizingCanvasItem : QgsMapCanvasItem
{
%Docstring
Expand All @@ -19,6 +24,12 @@ The QgsAdvancedDigitizingCanvasItem class draws the graphical elements of the CA

%TypeHeaderCode
#include "qgsadvanceddigitizingcanvasitem.h"
%End
%ConvertToSubClassCode
if ( dynamic_cast<QgsAdvancedDigitizingCanvasItem *>( sipCpp ) )
sipType = sipType_QgsAdvancedDigitizingCanvasItem;
else
sipType = nullptr;
%End
public:
explicit QgsAdvancedDigitizingCanvasItem( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget );
Expand Down
10 changes: 10 additions & 0 deletions python/gui/auto_generated/qgsgeometryrubberband.sip.in
Expand Up @@ -9,6 +9,10 @@



%ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgsgeometryrubberband.h>
%End


class QgsGeometryRubberBand: QgsMapCanvasItem
Expand All @@ -19,6 +23,12 @@ A rubberband class for QgsAbstractGeometry (considering curved geometries)*

%TypeHeaderCode
#include "qgsgeometryrubberband.h"
%End
%ConvertToSubClassCode
if ( dynamic_cast<QgsGeometryRubberBand *>( sipCpp ) )
sipType = sipType_QgsGeometryRubberBand;
else
sipType = nullptr;
%End
public:
enum IconType
Expand Down
16 changes: 14 additions & 2 deletions python/gui/auto_generated/qgshighlight.sip.in
Expand Up @@ -8,6 +8,11 @@



%ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgshighlight.h>
%End

class QgsHighlight: QObject, QgsMapCanvasItem
{
%Docstring
Expand All @@ -28,10 +33,17 @@ for highlighting features or geometries on a map canvas.

%TypeHeaderCode
#include "qgshighlight.h"
%End
%ConvertToSubClassCode
if ( dynamic_cast<QgsHighlight *>( sipCpp ) )
sipType = sipType_QgsHighlight;
else
sipType = nullptr;
%End
public:

QgsHighlight( QgsMapCanvas *mapCanvas, const QgsGeometry &geom, QgsMapLayer *layer );

QgsHighlight( QgsMapCanvas *mapCanvas /TransferThis/, const QgsGeometry &geom, QgsMapLayer *layer );
%Docstring
Constructor for QgsHighlight

Expand All @@ -40,7 +52,7 @@ Constructor for QgsHighlight
:param layer: associated map layer
%End

QgsHighlight( QgsMapCanvas *mapCanvas, const QgsFeature &feature, QgsVectorLayer *layer );
QgsHighlight( QgsMapCanvas *mapCanvas /TransferThis/, const QgsFeature &feature, QgsVectorLayer *layer );
%Docstring
Constructor for highlighting ``True`` feature shape using feature attributes
and renderer.
Expand Down
11 changes: 11 additions & 0 deletions python/gui/auto_generated/qgsmapcanvasannotationitem.sip.in
Expand Up @@ -8,6 +8,11 @@



%ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgsmapcanvasannotationitem.h>
%End



class QgsMapCanvasAnnotationItem: QObject, QgsMapCanvasItem
Expand All @@ -20,6 +25,12 @@ An interactive map canvas item which displays a QgsAnnotation.

%TypeHeaderCode
#include "qgsmapcanvasannotationitem.h"
%End
%ConvertToSubClassCode
if ( dynamic_cast<QgsMapCanvasAnnotationItem *>( sipCpp ) )
sipType = sipType_QgsMapCanvasAnnotationItem;
else
sipType = nullptr;
%End
public:

Expand Down
11 changes: 11 additions & 0 deletions python/gui/auto_generated/qgsrubberband.sip.in
Expand Up @@ -10,6 +10,11 @@



%ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgsrubberband.h>
%End

class QgsRubberBand : QObject, QgsMapCanvasItem
{
%Docstring
Expand All @@ -21,6 +26,12 @@ for tracking the mouse while drawing polylines or polygons.

%TypeHeaderCode
#include "qgsrubberband.h"
%End
%ConvertToSubClassCode
if ( dynamic_cast<QgsRubberBand *>( sipCpp ) )
sipType = sipType_QgsRubberBand;
else
sipType = nullptr;
%End
public:

Expand Down
11 changes: 11 additions & 0 deletions python/gui/auto_generated/qgssnaptogridcanvasitem.sip.in
Expand Up @@ -9,6 +9,11 @@



%ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgssnaptogridcanvasitem.h>
%End

class QgsSnapToGridCanvasItem : QObject, QgsMapCanvasItem
{
%Docstring
Expand All @@ -20,6 +25,12 @@ Shows a grid on the map canvas given a spatial resolution.

%TypeHeaderCode
#include "qgssnaptogridcanvasitem.h"
%End
%ConvertToSubClassCode
if ( dynamic_cast<QgsSnapToGridCanvasItem *>( sipCpp ) )
sipType = sipType_QgsSnapToGridCanvasItem;
else
sipType = nullptr;
%End
public:

Expand Down
17 changes: 17 additions & 0 deletions src/gui/qgsadvanceddigitizingcanvasitem.h
Expand Up @@ -24,12 +24,29 @@

class QgsAdvancedDigitizingDockWidget;

#ifdef SIP_RUN
% ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgsadvanceddigitizingcanvasitem.h>
% End
#endif

/**
* \ingroup gui
* \brief The QgsAdvancedDigitizingCanvasItem class draws the graphical elements of the CAD tools (\see QgsAdvancedDigitizingDockWidget) on the map canvas.
*/
class GUI_EXPORT QgsAdvancedDigitizingCanvasItem : public QgsMapCanvasItem
{

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( dynamic_cast<QgsAdvancedDigitizingCanvasItem *>( sipCpp ) )
sipType = sipType_QgsAdvancedDigitizingCanvasItem;
else
sipType = nullptr;
SIP_END
#endif

public:
explicit QgsAdvancedDigitizingCanvasItem( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget );

Expand Down
16 changes: 16 additions & 0 deletions src/gui/qgsgeometryrubberband.h
Expand Up @@ -24,6 +24,12 @@
#include <QPen>
#include "qgis_gui.h"

#ifdef SIP_RUN
% ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgsgeometryrubberband.h>
% End
#endif

class QgsAbstractGeometry;
class QgsPoint;
Expand All @@ -34,6 +40,16 @@ struct QgsVertexId;
* A rubberband class for QgsAbstractGeometry (considering curved geometries)*/
class GUI_EXPORT QgsGeometryRubberBand: public QgsMapCanvasItem
{

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( dynamic_cast<QgsGeometryRubberBand *>( sipCpp ) )
sipType = sipType_QgsGeometryRubberBand;
else
sipType = nullptr;
SIP_END
#endif

public:
enum IconType
{
Expand Down
25 changes: 20 additions & 5 deletions src/gui/qgshighlight.h
Expand Up @@ -30,6 +30,13 @@ class QgsMapLayer;
class QgsVectorLayer;
class QgsSymbol;

#ifdef SIP_RUN
% ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgshighlight.h>
% End
#endif

/**
* \ingroup gui
* A class for highlight features on the map.
Expand All @@ -48,22 +55,30 @@ class QgsSymbol;
*/
class GUI_EXPORT QgsHighlight: public QObject, public QgsMapCanvasItem
{

Q_OBJECT

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( dynamic_cast<QgsHighlight *>( sipCpp ) )
sipType = sipType_QgsHighlight;
else
sipType = nullptr;
SIP_END
#endif
public:

Q_PROPERTY( QColor color READ color WRITE setColor )
Q_PROPERTY( QColor fillColor READ fillColor WRITE setFillColor )
Q_PROPERTY( int width READ width WRITE setWidth )
Q_PROPERTY( int buffer READ buffer WRITE setBuffer )

public:

/**
* Constructor for QgsHighlight
* \param mapCanvas associated map canvas
* \param geom initial geometry of highlight
* \param layer associated map layer
*/
QgsHighlight( QgsMapCanvas *mapCanvas, const QgsGeometry &geom, QgsMapLayer *layer );
QgsHighlight( QgsMapCanvas *mapCanvas SIP_TRANSFERTHIS, const QgsGeometry &geom, QgsMapLayer *layer );

/**
* Constructor for highlighting TRUE feature shape using feature attributes
Expand All @@ -72,7 +87,7 @@ class GUI_EXPORT QgsHighlight: public QObject, public QgsMapCanvasItem
* \param feature
* \param layer vector layer
*/
QgsHighlight( QgsMapCanvas *mapCanvas, const QgsFeature &feature, QgsVectorLayer *layer );
QgsHighlight( QgsMapCanvas *mapCanvas SIP_TRANSFERTHIS, const QgsFeature &feature, QgsVectorLayer *layer );
~QgsHighlight() override;

/**
Expand Down
16 changes: 16 additions & 0 deletions src/gui/qgsmapcanvasannotationitem.h
Expand Up @@ -18,6 +18,13 @@
#ifndef QGSMAPCANVASANNOTATIONITEM_H
#define QGSMAPCANVASANNOTATIONITEM_H

#ifdef SIP_RUN
% ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgsmapcanvasannotationitem.h>
% End
#endif

#include "qgsmapcanvasitem.h"
#include "qgis_gui.h"

Expand All @@ -33,6 +40,15 @@ class GUI_EXPORT QgsMapCanvasAnnotationItem: public QObject, public QgsMapCanvas
{
Q_OBJECT

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( dynamic_cast<QgsMapCanvasAnnotationItem *>( sipCpp ) )
sipType = sipType_QgsMapCanvasAnnotationItem;
else
sipType = nullptr;
SIP_END
#endif

public:

//! Mouse actions for interacting with item
Expand Down
16 changes: 16 additions & 0 deletions src/gui/qgsrubberband.h
Expand Up @@ -31,6 +31,13 @@
class QgsVectorLayer;
class QPaintEvent;

#ifdef SIP_RUN
% ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgsrubberband.h>
% End
#endif

/**
* \ingroup gui
* A class for drawing transient features (e.g. digitizing lines) on the map.
Expand All @@ -41,6 +48,15 @@ class QPaintEvent;
class GUI_EXPORT QgsRubberBand : public QObject, public QgsMapCanvasItem
{
Q_OBJECT

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( dynamic_cast<QgsRubberBand *>( sipCpp ) )
sipType = sipType_QgsRubberBand;
else
sipType = nullptr;
SIP_END
#endif
public:

Q_PROPERTY( QColor fillColor READ fillColor WRITE setFillColor )
Expand Down
16 changes: 16 additions & 0 deletions src/gui/qgssnaptogridcanvasitem.h
Expand Up @@ -23,6 +23,13 @@
#include "qgsmapcanvasitem.h"
#include "qgscoordinatetransform.h"

#ifdef SIP_RUN
% ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgssnaptogridcanvasitem.h>
% End
#endif

/**
* \ingroup gui
*
Expand All @@ -34,6 +41,15 @@ class GUI_EXPORT QgsSnapToGridCanvasItem : public QObject, public QgsMapCanvasIt
{
Q_OBJECT

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( dynamic_cast<QgsSnapToGridCanvasItem *>( sipCpp ) )
sipType = sipType_QgsSnapToGridCanvasItem;
else
sipType = nullptr;
SIP_END
#endif

public:

/**
Expand Down

0 comments on commit cdd3a55

Please sign in to comment.