From: Nicklas Avén Date: Sat, 4 Apr 2015 19:42:02 +0000 (+0000) Subject: simplifyvw: allow polygon inner rings to collapse X-Git-Tag: 2.2.0rc1~561 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ead61fccf6219fa608afc4a0b6ec677abd842a0;p=postgis simplifyvw: allow polygon inner rings to collapse git-svn-id: http://svn.osgeo.org/postgis/trunk@13420 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/effectivearea.c b/liblwgeom/effectivearea.c index f8d301ef7..b89fd2cb3 100644 --- a/liblwgeom/effectivearea.c +++ b/liblwgeom/effectivearea.c @@ -423,6 +423,7 @@ static POINTARRAY * ptarray_set_effective_area(POINTARRAY *inpts,int avoid_colla } } destroy_effectivearea(ea); + return opts; } @@ -455,6 +456,7 @@ static LWPOLY* lwpoly_set_effective_area(const LWPOLY *ipoly,int set_area, doubl LWDEBUG(2, "Entered lwpoly_set_effective_area"); int i; int set_m; + int avoid_collapse=4; if(set_area) set_m=1; else @@ -467,9 +469,15 @@ static LWPOLY* lwpoly_set_effective_area(const LWPOLY *ipoly,int set_area, doubl for (i = 0; i < ipoly->nrings; i++) { + POINTARRAY *pa = ptarray_set_effective_area(ipoly->rings[i],avoid_collapse,set_area,trshld); /* Add ring to simplified polygon */ - if( lwpoly_add_ring(opoly, ptarray_set_effective_area(ipoly->rings[i],4,set_area,trshld)) == LW_FAILURE ) - return NULL; + if(pa->npoints>=4) + { + if( lwpoly_add_ring(opoly,pa ) == LW_FAILURE ) + return NULL; + } + /*Inner rings we allow to ocollapse and then we remove them*/ + avoid_collapse=0; }