Skip to content

Commit 7e0ef8f

Browse files
committedJun 11, 2014
#10433: Fix simplification of invalid and empty multipolygons
1 parent 48b099c commit 7e0ef8f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed
 

‎src/core/qgsmaptopixelgeometrysimplifier.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,17 @@ bool QgsMapToPixelSimplifier::simplifyWkbGeometry( int simplifyFlags, QGis::WkbT
247247
// Fix the topology of the geometry
248248
if ( numTargetPoints <= ( isaLinearRing ? 2 : 1 ) )
249249
{
250+
unsigned char* targetTempWkb = targetWkb;
251+
int targetWkbTempSize = targetWkbSize;
252+
250253
sourceWkb = sourcePrevWkb;
251254
targetWkb = targetPrevWkb;
252255
targetWkbSize = targetWkbPrevSize;
253-
return generalizeWkbGeometry( wkbType, sourceWkb, sourceWkbSize, targetWkb, targetWkbSize, QgsRectangle( xmin, ymin, xmax, ymax ), writeHeader );
256+
bool isok = generalizeWkbGeometry( wkbType, sourceWkb, sourceWkbSize, targetWkb, targetWkbSize, QgsRectangle( xmin, ymin, xmax, ymax ), writeHeader );
257+
if ( isok ) return true;
258+
259+
targetWkb = targetTempWkb;
260+
targetWkbSize = targetWkbTempSize;
254261
}
255262
if ( isaLinearRing )
256263
{

‎src/core/qgspallabeling.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,8 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, const QgsRenderContext
19171917
// fix invalid polygons
19181918
if ( geom->type() == QGis::Polygon && !geom->isGeosValid() )
19191919
{
1920-
geom->fromGeos( GEOSBuffer( geom->asGeos(), 0, 0 ) );
1920+
const GEOSGeometry* geos = geom->asGeos();
1921+
if ( geos ) geom->fromGeos( GEOSBuffer( geos, 0, 0 ) );
19211922
}
19221923

19231924
// CLIP the geometry if it is bigger than the extent

0 commit comments

Comments
 (0)
Please sign in to comment.