fix #30766, sip crash for QgsHighlight

This commit is contained in:
Peter Petrik 2019-09-13 09:37:16 +02:00 committed by Nyall Dawson
parent 0d26d64b2e
commit cdd3a55e9e
12 changed files with 169 additions and 7 deletions

View File

@ -11,6 +11,11 @@
%ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgsadvanceddigitizingcanvasitem.h>
%End
class QgsAdvancedDigitizingCanvasItem : QgsMapCanvasItem
{
%Docstring
@ -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 );

View File

@ -9,6 +9,10 @@
%ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgsgeometryrubberband.h>
%End
class QgsGeometryRubberBand: QgsMapCanvasItem
@ -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

View File

@ -8,6 +8,11 @@
%ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgshighlight.h>
%End
class QgsHighlight: QObject, QgsMapCanvasItem
{
%Docstring
@ -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
@ -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.

View File

@ -8,6 +8,11 @@
%ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgsmapcanvasannotationitem.h>
%End
class QgsMapCanvasAnnotationItem: QObject, QgsMapCanvasItem
@ -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:

View File

@ -10,6 +10,11 @@
%ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgsrubberband.h>
%End
class QgsRubberBand : QObject, QgsMapCanvasItem
{
%Docstring
@ -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:

View File

@ -9,6 +9,11 @@
%ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgssnaptogridcanvasitem.h>
%End
class QgsSnapToGridCanvasItem : QObject, QgsMapCanvasItem
{
%Docstring
@ -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:

View File

@ -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 );

View File

@ -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;
@ -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
{

View File

@ -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.
@ -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
@ -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;
/**

View File

@ -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"
@ -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

View File

@ -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.
@ -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 )

View File

@ -23,6 +23,13 @@
#include "qgsmapcanvasitem.h"
#include "qgscoordinatetransform.h"
#ifdef SIP_RUN
% ModuleHeaderCode
// For ConvertToSubClassCode.
#include <qgssnaptogridcanvasitem.h>
% End
#endif
/**
* \ingroup gui
*
@ -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:
/**