Merge linestrings together in union operation. Otherwise geos would create a multilinestring containing the linestrings

git-svn-id: http://svn.osgeo.org/qgis/trunk@10869 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
mhugent 2009-06-01 13:23:31 +00:00
parent 6f8f05bbd5
commit 092a1bf694

View File

@ -5448,7 +5448,20 @@ QgsGeometry* QgsGeometry::combine( QgsGeometry* geometry )
try
{
return fromGeosGeom( GEOSUnion( mGeos, geometry->mGeos ) );
GEOSGeometry* unionGeom = GEOSUnion( mGeos, geometry->mGeos );
QGis::WkbType thisGeomType = wkbType();
QGis::WkbType otherGeomType = geometry->wkbType();
if( (thisGeomType == QGis::WKBLineString || thisGeomType == QGis::WKBLineString25D) \
&& (otherGeomType == QGis::WKBLineString || otherGeomType == QGis::WKBLineString25D) )
{
GEOSGeometry* mergedGeom = GEOSLineMerge(unionGeom);
if(mergedGeom)
{
GEOSGeom_destroy(unionGeom);
unionGeom = mergedGeom;
}
}
return fromGeosGeom(unionGeom);
}
CATCH_GEOS( new QgsGeometry( *this ) ) //return this geometry if union not possible
}