From: Paul Ramsey Date: Wed, 14 Nov 2012 21:25:52 +0000 (+0000) Subject: #2001, ST_CurveToLine has no effect if the geometry doesn't actually contain an arc X-Git-Tag: 2.1.0beta2~398 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cd86fc540a98249412e7b4d5d22fd4075187bb69;p=postgis #2001, ST_CurveToLine has no effect if the geometry doesn't actually contain an arc git-svn-id: http://svn.osgeo.org/postgis/trunk@10671 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/lwsegmentize.c b/liblwgeom/lwsegmentize.c index 28606377d..bc99de5eb 100644 --- a/liblwgeom/lwsegmentize.c +++ b/liblwgeom/lwsegmentize.c @@ -260,7 +260,7 @@ lwcompound_segmentize(const LWCOMPOUND *icompound, uint32_t perQuad) getPoint4d_p(tmp->points, j, &p); ptarray_append_point(ptarray, &p, LW_TRUE); } - lwfree(tmp); + lwline_free(tmp); } else if (geom->type == LINETYPE) { diff --git a/postgis/lwgeom_sqlmm.c b/postgis/lwgeom_sqlmm.c index 37ec9f0ac..819f8aa8f 100644 --- a/postgis/lwgeom_sqlmm.c +++ b/postgis/lwgeom_sqlmm.c @@ -65,21 +65,17 @@ Datum LWGEOM_curve_segmentize(PG_FUNCTION_ARGS) elog(ERROR, "2nd argument must be positive."); PG_RETURN_NULL(); } -#if POSTGIS_DEBUG_LEVEL > 0 - else - { - POSTGIS_DEBUGF(3, "perQuad = %d", perQuad); - } -#endif + + POSTGIS_DEBUGF(3, "perQuad = %d", perQuad); + igeom = lwgeom_from_gserialized(geom); - if ( ! lwgeom_has_arc(igeom) ) - { - PG_RETURN_POINTER(geom); - } ogeom = lwgeom_segmentize(igeom, perQuad); - if (ogeom == NULL) PG_RETURN_NULL(); - ret = geometry_serialize(ogeom); lwgeom_free(igeom); + + if (ogeom == NULL) + PG_RETURN_NULL(); + + ret = geometry_serialize(ogeom); lwgeom_free(ogeom); PG_FREE_IF_COPY(geom, 0); PG_RETURN_POINTER(ret); diff --git a/regress/tickets.sql b/regress/tickets.sql index 0e3ae6775..ef5b741b8 100644 --- a/regress/tickets.sql +++ b/regress/tickets.sql @@ -728,6 +728,9 @@ SELECT '#1978', round(ST_Length(ST_GeomFromText('CIRCULARSTRING(0 0,1 0,0 0)',0) -- #1996 -- SELECT '#1996', ST_AsGeoJSON(ST_GeomFromText('POINT EMPTY')); +-- #2001 -- +SELECT '#2001', ST_AsText(ST_CurveToLine(ST_GeomFromText('CURVEPOLYGON((0 0, 0 1, 1 1, 0 0))'), 2)); + -- #2084 -- SELECT '#2048', num, ST_Within('POINT(-54.394 56.522)', "the_geom"), ST_CoveredBy('POINT(-54.394 56.522)', "the_geom") FROM ( VALUES diff --git a/regress/tickets_expected b/regress/tickets_expected index 72b195432..36e67a3d6 100644 --- a/regress/tickets_expected +++ b/regress/tickets_expected @@ -230,6 +230,7 @@ ERROR: invalid GML representation #1957|1 #1978|3.1413 #1996|{"type":"Point","coordinates":[]} +#2001|POLYGON((0 0,0 1,1 1,0 0)) #2048|1|f|f #2048|2|t|t #2048|3|f|f