[QGIS Commit] r9469 - trunk/qgis/src/core
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Fri Oct 10 09:26:39 EDT 2008
Author: wonder
Date: 2008-10-10 09:26:39 -0400 (Fri, 10 Oct 2008)
New Revision: 9469
Modified:
trunk/qgis/src/core/qgsgeometry.cpp
Log:
correct cloning of multi-part geometries with GEOS < 3.0
Modified: trunk/qgis/src/core/qgsgeometry.cpp
===================================================================
--- trunk/qgis/src/core/qgsgeometry.cpp 2008-10-10 11:32:51 UTC (rev 9468)
+++ trunk/qgis/src/core/qgsgeometry.cpp 2008-10-10 13:26:39 UTC (rev 9469)
@@ -142,7 +142,11 @@
static GEOSGeometry *cloneGeosGeom( const GEOSGeometry *geom )
{
- if ( GEOSGeomTypeId(( GEOSGeometry * ) geom ) == GEOS_MULTIPOLYGON )
+ // for GEOS < 3.0 we have own cloning function
+ // because when cloning multipart geometries they're copied into more general geometry collection instance
+ int type = GEOSGeomTypeId(( GEOSGeometry * ) geom );
+
+ if (type == GEOS_MULTIPOINT || type == GEOS_MULTILINESTRING || type == GEOS_MULTIPOLYGON)
{
QVector<GEOSGeometry *> geoms;
@@ -152,7 +156,7 @@
for ( int i = 0; i < GEOSGetNumGeometries(( GEOSGeometry * )geom ); ++i )
geoms << GEOSGeom_clone(( GEOSGeometry * ) GEOSGetGeometryN(( GEOSGeometry * ) geom, i ) );
- return createGeosCollection( GEOS_MULTIPOLYGON, geoms );
+ return createGeosCollection( type, geoms );
}
catch ( GEOSException &e )
{
@@ -4508,6 +4512,7 @@
case GEOS_GEOMETRYCOLLECTION: // a collection of heterogeneus geometries
{
// TODO
+ QgsDebugMsg("geometry collection - not supported");
break;
} // case GEOS_GEOM::GEOS_GEOMETRYCOLLECTION
More information about the QGIS-commit
mailing list