Skip to content
Permalink
Browse files

Fix multicurve allowing insertion of non curve geometries

  • Loading branch information
nyalldawson committed Sep 26, 2017
1 parent 6505104 commit ed90bf4dedc6b0887eae1d6df90553782232743d
@@ -38,6 +38,8 @@ class QgsMultiCurve: QgsGeometryCollection

virtual bool addGeometry( QgsAbstractGeometry *g /Transfer/ );

virtual bool insertGeometry( QgsAbstractGeometry *g /Transfer/, int index );


QgsMultiCurve *reversed() const /Factory/;
%Docstring
@@ -142,6 +142,17 @@ bool QgsMultiCurve::addGeometry( QgsAbstractGeometry *g )
return QgsGeometryCollection::addGeometry( g );
}

bool QgsMultiCurve::insertGeometry( QgsAbstractGeometry *g, int index )
{
if ( !g || !qgsgeometry_cast<QgsCurve *>( g ) )
{
delete g;
return false;
}

return QgsGeometryCollection::insertGeometry( g, index );
}

QgsMultiCurve *QgsMultiCurve::reversed() const
{
QgsMultiCurve *reversedMultiCurve = new QgsMultiCurve();
@@ -38,6 +38,7 @@ class CORE_EXPORT QgsMultiCurve: public QgsGeometryCollection
QDomElement asGML3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const override;
QString asJSON( int precision = 17 ) const override;
bool addGeometry( QgsAbstractGeometry *g SIP_TRANSFER ) override;
bool insertGeometry( QgsAbstractGeometry *g SIP_TRANSFER, int index ) override;

/** Returns a copy of the multi curve, where each component curve has had its line direction reversed.
* \since QGIS 2.14

0 comments on commit ed90bf4

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