Skip to content

Commit 8cecff2

Browse files
author
mhugent
committed
Fix for reshape of multilines
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11505 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 8b096ec commit 8cecff2

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/core/qgsgeometry.cpp

+17-2
Original file line numberDiff line numberDiff line change
@@ -3243,7 +3243,13 @@ int QgsGeometry::reshapeGeometry( const QList<QgsPoint>& reshapeWithLine )
32433243
return 1;
32443244
}
32453245

3246-
bool isMultiGeom = ( numGeoms > 1 );
3246+
bool isMultiGeom = false;
3247+
int geosTypeId = GEOSGeomTypeId( mGeos );
3248+
if ( geosTypeId == GEOS_MULTILINESTRING || geosTypeId == GEOS_MULTIPOLYGON )
3249+
{
3250+
isMultiGeom = true;
3251+
}
3252+
32473253
bool isLine = ( type() == QGis::Line );
32483254

32493255
//polygon or multipolygon?
@@ -3303,7 +3309,16 @@ int QgsGeometry::reshapeGeometry( const QList<QgsPoint>& reshapeWithLine )
33033309
}
33043310
GEOSGeom_destroy( reshapeLineGeos );
33053311

3306-
GEOSGeometry* newMultiGeom = GEOSGeom_createCollection( GEOS_MULTIPOLYGON, newGeoms, numGeoms );
3312+
GEOSGeometry* newMultiGeom = 0;
3313+
if ( isLine )
3314+
{
3315+
newMultiGeom = GEOSGeom_createCollection( GEOS_MULTILINESTRING, newGeoms, numGeoms );
3316+
}
3317+
else //multipolygon
3318+
{
3319+
newMultiGeom = GEOSGeom_createCollection( GEOS_MULTIPOLYGON, newGeoms, numGeoms );
3320+
}
3321+
33073322
delete[] newGeoms;
33083323
if ( ! newMultiGeom )
33093324
{

0 commit comments

Comments
 (0)