mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Use the layer type when adding a part to a featureless entry. Fix #8459
This commit is contained in:
parent
c59cd92c12
commit
872e500679
@ -2890,9 +2890,12 @@ int QgsGeometry::addRing( const QList<QgsPoint>& ring )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QgsGeometry::addPart( const QList<QgsPoint> &points )
|
int QgsGeometry::addPart( const QList<QgsPoint> &points, QGis::GeometryType geomType )
|
||||||
{
|
{
|
||||||
QGis::GeometryType geomType = type();
|
if ( geomType == QGis::UnknownGeometry )
|
||||||
|
{
|
||||||
|
geomType = type();
|
||||||
|
}
|
||||||
|
|
||||||
switch ( geomType )
|
switch ( geomType )
|
||||||
{
|
{
|
||||||
@ -2977,6 +2980,11 @@ int QgsGeometry::addPart( const QList<QgsPoint> &points )
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( type() == QGis::UnknownGeometry )
|
||||||
|
{
|
||||||
|
fromGeos( newPart );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return addPart( newPart );
|
return addPart( newPart );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ class CORE_EXPORT QgsGeometry
|
|||||||
/**Adds a new island polygon to a multipolygon feature
|
/**Adds a new island polygon to a multipolygon feature
|
||||||
@return 0 in case of success, 1 if not a multipolygon, 2 if ring is not a valid geometry, 3 if new polygon ring
|
@return 0 in case of success, 1 if not a multipolygon, 2 if ring is not a valid geometry, 3 if new polygon ring
|
||||||
not disjoint with existing polygons of the feature*/
|
not disjoint with existing polygons of the feature*/
|
||||||
int addPart( const QList<QgsPoint> &points );
|
int addPart( const QList<QgsPoint> &points, QGis::GeometryType geomType = QGis::UnknownGeometry );
|
||||||
|
|
||||||
/**Adds a new island polygon to a multipolygon feature
|
/**Adds a new island polygon to a multipolygon feature
|
||||||
@return 0 in case of success, 1 if not a multipolygon, 2 if ring is not a valid geometry, 3 if new polygon ring
|
@return 0 in case of success, 1 if not a multipolygon, 2 if ring is not a valid geometry, 3 if new polygon ring
|
||||||
|
@ -130,7 +130,7 @@ int QgsVectorLayerEditUtils::addPart( const QList<QgsPoint> &points, QgsFeatureI
|
|||||||
geometry = *f.geometry();
|
geometry = *f.geometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
int errorCode = geometry.addPart( points );
|
int errorCode = geometry.addPart( points, L->geometryType() );
|
||||||
if ( errorCode == 0 )
|
if ( errorCode == 0 )
|
||||||
{
|
{
|
||||||
L->editBuffer()->changeGeometry( featureId, &geometry );
|
L->editBuffer()->changeGeometry( featureId, &geometry );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user