Skip to content

Commit ba50bf0

Browse files
committedSep 25, 2017
Fix multi point allowing insertion of non point geometries
1 parent 97930d1 commit ba50bf0

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed
 

‎python/core/geometry/qgsmultipoint.sip

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ class QgsMultiPointV2: QgsGeometryCollection
4848
Adds a geometry and takes ownership. Returns true in case of success
4949
:rtype: bool
5050
%End
51+
virtual bool insertGeometry( QgsAbstractGeometry *g /Transfer/, int index );
52+
5153

5254
virtual QgsAbstractGeometry *boundary() const /Factory/;
5355

‎src/core/geometry/qgsmultipoint.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ bool QgsMultiPointV2::addGeometry( QgsAbstractGeometry *g )
127127
return QgsGeometryCollection::addGeometry( g );
128128
}
129129

130+
bool QgsMultiPointV2::insertGeometry( QgsAbstractGeometry *g, int index )
131+
{
132+
if ( !g || QgsWkbTypes::flatType( g->wkbType() ) != QgsWkbTypes::Point )
133+
return false;
134+
135+
return QgsGeometryCollection::insertGeometry( g, index );
136+
}
137+
130138
QgsAbstractGeometry *QgsMultiPointV2::boundary() const
131139
{
132140
return nullptr;

‎src/core/geometry/qgsmultipoint.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class CORE_EXPORT QgsMultiPointV2: public QgsGeometryCollection
4747

4848
//! Adds a geometry and takes ownership. Returns true in case of success
4949
bool addGeometry( QgsAbstractGeometry *g SIP_TRANSFER ) override;
50+
bool insertGeometry( QgsAbstractGeometry *g SIP_TRANSFER, int index ) override;
5051

5152
QgsAbstractGeometry *boundary() const override SIP_FACTORY;
5253

0 commit comments

Comments
 (0)
Please sign in to comment.