mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
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:
parent
6f8f05bbd5
commit
092a1bf694
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user