Skip to content

Commit abe249d

Browse files
author
wonder
committedOct 10, 2008

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed
 

‎src/core/qgsgeometry.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ static GEOSGeometry *createGeosCollection( int typeId, QVector<GEOSGeometry*> ge
142142

143143
static GEOSGeometry *cloneGeosGeom( const GEOSGeometry *geom )
144144
{
145-
if ( GEOSGeomTypeId(( GEOSGeometry * ) geom ) == GEOS_MULTIPOLYGON )
145+
// for GEOS < 3.0 we have own cloning function
146+
// because when cloning multipart geometries they're copied into more general geometry collection instance
147+
int type = GEOSGeomTypeId(( GEOSGeometry * ) geom );
148+
149+
if (type == GEOS_MULTIPOINT || type == GEOS_MULTILINESTRING || type == GEOS_MULTIPOLYGON)
146150
{
147151
QVector<GEOSGeometry *> geoms;
148152

@@ -152,7 +156,7 @@ static GEOSGeometry *cloneGeosGeom( const GEOSGeometry *geom )
152156
for ( int i = 0; i < GEOSGetNumGeometries(( GEOSGeometry * )geom ); ++i )
153157
geoms << GEOSGeom_clone(( GEOSGeometry * ) GEOSGetGeometryN(( GEOSGeometry * ) geom, i ) );
154158

155-
return createGeosCollection( GEOS_MULTIPOLYGON, geoms );
159+
return createGeosCollection( type, geoms );
156160
}
157161
catch ( GEOSException &e )
158162
{
@@ -4508,6 +4512,7 @@ bool QgsGeometry::exportGeosToWkb()
45084512
case GEOS_GEOMETRYCOLLECTION: // a collection of heterogeneus geometries
45094513
{
45104514
// TODO
4515+
QgsDebugMsg("geometry collection - not supported");
45114516
break;
45124517
} // case GEOS_GEOM::GEOS_GEOMETRYCOLLECTION
45134518

0 commit comments

Comments
 (0)
Please sign in to comment.