File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -278,7 +278,8 @@ not disjoint with existing polygons of the feature*/
278
278
279
279
/** return contents of the geometry as a list of geometries
280
280
@note added in version 1.1 */
281
- QList<QgsGeometry*> asGeometryCollection();
281
+ // TODO: destruction of created geometries??
282
+ QList<QgsGeometry*> asGeometryCollection() /Factory/;
282
283
283
284
}; // class QgsGeometry
284
285
Original file line number Diff line number Diff line change @@ -5457,20 +5457,21 @@ QList<QgsGeometry*> QgsGeometry::asGeometryCollection()
5457
5457
int type = GEOSGeomTypeId ( mGeos );
5458
5458
QgsDebugMsg (" geom type: " +QString::number (type));
5459
5459
5460
+ QList<QgsGeometry*> geomCollection;
5461
+
5460
5462
if ( type != GEOS_MULTIPOINT &&
5461
5463
type != GEOS_MULTILINESTRING &&
5462
5464
type != GEOS_MULTIPOLYGON &&
5463
5465
type != GEOS_GEOMETRYCOLLECTION )
5464
5466
{
5465
- // we have a single-part geometry
5466
- return QList<QgsGeometry*>();
5467
+ // we have a single-part geometry - put there a copy of this one
5468
+ geomCollection.append ( new QgsGeometry (*this ) );
5469
+ return geomCollection;
5467
5470
}
5468
5471
5469
5472
int count = GEOSGetNumGeometries ( mGeos );
5470
5473
QgsDebugMsg (" geom count: " +QString::number (count));
5471
5474
5472
- QList<QgsGeometry*> geomCollection;
5473
-
5474
5475
for ( int i = 0 ; i < count; ++i )
5475
5476
{
5476
5477
const GEOSGeometry * geometry = GEOSGetGeometryN ( mGeos , i );
You can’t perform that action at this time.
0 commit comments