]> granicus.if.org Git - postgis/commitdiff
#2001, ST_CurveToLine has no effect if the geometry doesn't actually contain an arc
authorPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 14 Nov 2012 21:25:52 +0000 (21:25 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 14 Nov 2012 21:25:52 +0000 (21:25 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@10671 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/lwsegmentize.c
postgis/lwgeom_sqlmm.c
regress/tickets.sql
regress/tickets_expected

index 28606377df8f008d5ab1623690bbc3dc57c2c3d8..bc99de5ebf2f0f670811de4788a079c0d98f8375 100644 (file)
@@ -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)
                {
index 37ec9f0ac9d47c925fd34daafa810e1a7a97e9c1..819f8aa8f62b2d5717fa8d8b524df3e56b5e6b2f 100644 (file)
@@ -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);
index 0e3ae677504469839e18cf6134d0429d44fa8c34..ef5b741b83aef215b1b0977c40ab0eac82c684bd 100644 (file)
@@ -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
index 72b195432b3b3b794a320700bccdb9d9f74f3d4d..36e67a3d61360089539228b82fe710a408fe830c 100644 (file)
@@ -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