From: Paul Ramsey Date: Tue, 30 Jun 2015 15:27:59 +0000 (+0000) Subject: Rename _segmentize to _stroke to distinguish arc stroking routines from line densific... X-Git-Tag: 2.2.0rc1~276 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f44beeffe1c575a13df59985666fdf7ddd0b8797;p=postgis Rename _segmentize to _stroke to distinguish arc stroking routines from line densification routines git-svn-id: http://svn.osgeo.org/postgis/trunk@13762 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/ChangeLog b/ChangeLog index 2d1bde092..ef3c15a47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1275,7 +1275,7 @@ 2012-12-20 17:19 strk - * Fix memory leaks in lwsegmentize and cu_ptarray + * Fix memory leaks in lwstroke and cu_ptarray 2012-12-20 16:02 robe @@ -31443,7 +31443,7 @@ 2008-09-16 18:44 mcayland * Move the LWGEOM-specific functions from lwgeom_sqlmm.c into - liblwgeom/lwsegmentize.c to ensure that liblwgeom can exist as a + liblwgeom/lwstroke.c to ensure that liblwgeom can exist as a standalone library. 2008-09-16 13:35 robe diff --git a/liblwgeom/Makefile.in b/liblwgeom/Makefile.in index 8ec7e0898..dbcc1ed82 100644 --- a/liblwgeom/Makefile.in +++ b/liblwgeom/Makefile.in @@ -66,7 +66,7 @@ SA_OBJS = \ lwutil.o \ lwhomogenize.o \ lwalgorithm.o \ - lwsegmentize.o \ + lwstroke.o \ lwlinearreferencing.o \ lwprint.o \ g_box.o \ diff --git a/liblwgeom/cunit/cu_ptarray.c b/liblwgeom/cunit/cu_ptarray.c index 46e8022de..f07651cde 100644 --- a/liblwgeom/cunit/cu_ptarray.c +++ b/liblwgeom/cunit/cu_ptarray.c @@ -342,7 +342,7 @@ static void test_ptarray_signed_area() -static void test_ptarray_desegmentize() +static void test_ptarray_unstroke() { LWGEOM *in, *out; char *str; @@ -351,7 +351,7 @@ static void test_ptarray_desegmentize() but it looks like the intersection itself is too sloppy in generating the derived point to accurately reconstruct the circles. in = lwgeom_from_text("POLYGON((0.5 0,0.471177920604846 -0.292635483024192,0.38581929876693 -0.574025148547634,0.247204418453818 -0.833355349529403,0.0606601717798223 -1.06066017177982,-5.44089437167602e-17 -1.11044268820754,-0.0606601717798188 -1.06066017177982,-0.247204418453816 -0.833355349529406,-0.385819298766929 -0.574025148547639,-0.471177920604845 -0.292635483024197,-0.5 -4.84663372329776e-15,-0.471177920604847 0.292635483024187,-0.385819298766932 0.57402514854763,-0.247204418453821 0.833355349529398,-0.0606601717798256 1.06066017177982,3.45538806345173e-16 1.11044268820754,0.0606601717798183 1.06066017177982,0.247204418453816 0.833355349529407,0.385819298766929 0.574025148547638,0.471177920604845 0.292635483024196,0.5 0))"); - out = lwgeom_desegmentize(in); + out = lwgeom_unstroke(in); str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL); printf("%s\n", str); ASSERT_STRING_EQUAL(str, "CIRCULARSTRING(-1 0,0 1,0 -1)"); @@ -361,10 +361,10 @@ static void test_ptarray_desegmentize() */ in = lwgeom_from_text("CIRCULARSTRING(-1 0,0 1,0 -1)"); - out = lwgeom_segmentize(in,8); + out = lwgeom_stroke(in,8); lwgeom_free(in); in = out; - out = lwgeom_desegmentize(in); + out = lwgeom_unstroke(in); str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL); // printf("%s\n", str); ASSERT_STRING_EQUAL(str, "CIRCULARSTRING(-1 0,0.70710678 0.70710678,0 -1)"); @@ -373,10 +373,10 @@ static void test_ptarray_desegmentize() lwfree(str); in = lwgeom_from_text("COMPOUNDCURVE(CIRCULARSTRING(-1 0,0 1,0 -1),(0 -1,-1 -1))"); - out = lwgeom_segmentize(in,8); + out = lwgeom_stroke(in,8); lwgeom_free(in); in = out; - out = lwgeom_desegmentize(in); + out = lwgeom_unstroke(in); str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL); // printf("%s\n", str); ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE(CIRCULARSTRING(-1 0,0.70710678 0.70710678,0 -1),(0 -1,-1 -1))"); @@ -385,10 +385,10 @@ static void test_ptarray_desegmentize() lwfree(str); in = lwgeom_from_text("COMPOUNDCURVE((-3 -3,-1 0),CIRCULARSTRING(-1 0,0 1,0 -1),(0 -1,0 -1.5,0 -2),CIRCULARSTRING(0 -2,-1 -3,1 -3),(1 -3,5 5))"); - out = lwgeom_segmentize(in,8); + out = lwgeom_stroke(in,8); lwgeom_free(in); in = out; - out = lwgeom_desegmentize(in); + out = lwgeom_unstroke(in); str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL); // printf("%s\n", str); ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE((-3 -3,-1 0),CIRCULARSTRING(-1 0,0.70710678 0.70710678,0 -1),(0 -1,0 -1.5,0 -2),CIRCULARSTRING(0 -2,-0.70710678 -3.7071068,1 -3),(1 -3,5 5))"); @@ -397,10 +397,10 @@ static void test_ptarray_desegmentize() lwfree(str); in = lwgeom_from_text("COMPOUNDCURVE(CIRCULARSTRING(-1 0,0 1,0 -1),CIRCULARSTRING(0 -1,-1 -2,1 -2))"); - out = lwgeom_segmentize(in,8); + out = lwgeom_stroke(in,8); lwgeom_free(in); in = out; - out = lwgeom_desegmentize(in); + out = lwgeom_unstroke(in); str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL); // printf("%s\n", str); ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE(CIRCULARSTRING(-1 0,0.70710678 0.70710678,0 -1),CIRCULARSTRING(0 -1,-0.70710678 -2.7071068,1 -2))"); @@ -409,10 +409,10 @@ static void test_ptarray_desegmentize() lwfree(str); in = lwgeom_from_text("COMPOUNDCURVE((0 0, 1 1), CIRCULARSTRING(1 1, 2 2, 3 1), (3 1, 4 4))"); - out = lwgeom_segmentize(in,8); + out = lwgeom_stroke(in,8); lwgeom_free(in); in = out; - out = lwgeom_desegmentize(in); + out = lwgeom_unstroke(in); str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL); ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE((0 0,1 1),CIRCULARSTRING(1 1,2 2,3 1),(3 1,4 4))"); lwgeom_free(in); @@ -423,7 +423,7 @@ static void test_ptarray_desegmentize() // See http://trac.osgeo.org/postgis/ticket/2425 // and http://trac.osgeo.org/postgis/ticket/2420 in = lwgeom_from_text("LINESTRING(0 0,10 0,10 10,0 10,0 0)"); - out = lwgeom_desegmentize(in); + out = lwgeom_unstroke(in); str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL); ASSERT_STRING_EQUAL(str, "LINESTRING(0 0,10 0,10 10,0 10,0 0)"); lwgeom_free(in); @@ -431,7 +431,7 @@ static void test_ptarray_desegmentize() lwfree(str); in = lwgeom_from_text("LINESTRING(10 10,0 10,0 0,10 0)"); - out = lwgeom_desegmentize(in); + out = lwgeom_unstroke(in); str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL); ASSERT_STRING_EQUAL(str, "LINESTRING(10 10,0 10,0 0,10 0)"); // printf("%s\n", str); @@ -440,7 +440,7 @@ static void test_ptarray_desegmentize() lwfree(str); in = lwgeom_from_text("LINESTRING(0 0,10 0,10 10,0 10)"); - out = lwgeom_desegmentize(in); + out = lwgeom_unstroke(in); str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL); ASSERT_STRING_EQUAL(str, "LINESTRING(0 0,10 0,10 10,0 10)"); // printf("%s\n", str); @@ -450,7 +450,7 @@ static void test_ptarray_desegmentize() // See http://trac.osgeo.org/postgis/ticket/2412 in = lwgeom_from_text("LINESTRING(0 0, 1 1)"); - out = lwgeom_desegmentize(in); + out = lwgeom_unstroke(in); str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL); // printf("%s\n", str); ASSERT_STRING_EQUAL(str, "LINESTRING(0 0,1 1)"); @@ -749,7 +749,7 @@ void ptarray_suite_setup(void) PG_ADD_TEST(suite, test_ptarray_locate_point); PG_ADD_TEST(suite, test_ptarray_isccw); PG_ADD_TEST(suite, test_ptarray_signed_area); - PG_ADD_TEST(suite, test_ptarray_desegmentize); + PG_ADD_TEST(suite, test_ptarray_unstroke); PG_ADD_TEST(suite, test_ptarray_insert_point); PG_ADD_TEST(suite, test_ptarray_contains_point); PG_ADD_TEST(suite, test_ptarrayarc_contains_point); diff --git a/liblwgeom/liblwgeom.h.in b/liblwgeom/liblwgeom.h.in index d1c370ac9..11fd218d5 100644 --- a/liblwgeom/liblwgeom.h.in +++ b/liblwgeom/liblwgeom.h.in @@ -2009,8 +2009,8 @@ extern uint8_t* twkb_to_twkbcoll(uint8_t **twkb, size_t *sizes,size_t *out_size, ******************************************************************************/ int lwgeom_has_arc(const LWGEOM *geom); -LWGEOM *lwgeom_segmentize(LWGEOM *geom, uint32_t perQuad); -LWGEOM *lwgeom_desegmentize(LWGEOM *geom); +LWGEOM *lwgeom_stroke(LWGEOM *geom, uint32_t perQuad); +LWGEOM *lwgeom_unstroke(LWGEOM *geom); /******************************************************************************* * GEOS proxy functions on LWGEOM diff --git a/liblwgeom/liblwgeom_internal.h b/liblwgeom/liblwgeom_internal.h index b8ff9807a..de2a9a8e3 100644 --- a/liblwgeom/liblwgeom_internal.h +++ b/liblwgeom/liblwgeom_internal.h @@ -292,9 +292,9 @@ double lwtriangle_perimeter_2d(const LWTRIANGLE *triangle); /* * Segmentization */ -LWLINE *lwcircstring_segmentize(const LWCIRCSTRING *icurve, uint32_t perQuad); -LWLINE *lwcompound_segmentize(const LWCOMPOUND *icompound, uint32_t perQuad); -LWPOLY *lwcurvepoly_segmentize(const LWCURVEPOLY *curvepoly, uint32_t perQuad); +LWLINE *lwcircstring_stroke(const LWCIRCSTRING *icurve, uint32_t perQuad); +LWLINE *lwcompound_stroke(const LWCOMPOUND *icompound, uint32_t perQuad); +LWPOLY *lwcurvepoly_stroke(const LWCURVEPOLY *curvepoly, uint32_t perQuad); /* * Affine diff --git a/liblwgeom/lwcompound.c b/liblwgeom/lwcompound.c index 03b40af7f..ae2286f3d 100644 --- a/liblwgeom/lwcompound.c +++ b/liblwgeom/lwcompound.c @@ -59,7 +59,7 @@ double lwcompound_length(const LWCOMPOUND *comp) LWLINE *line; if ( lwgeom_is_empty((LWGEOM*)comp) ) return 0.0; - line = lwcompound_segmentize(comp, 32); + line = lwcompound_stroke(comp, 32); length = lwline_length(line); lwline_free(line); return length; @@ -71,7 +71,7 @@ double lwcompound_length_2d(const LWCOMPOUND *comp) LWLINE *line; if ( lwgeom_is_empty((LWGEOM*)comp) ) return 0.0; - line = lwcompound_segmentize(comp, 32); + line = lwcompound_stroke(comp, 32); length = lwline_length_2d(line); lwline_free(line); return length; diff --git a/liblwgeom/lwcurvepoly.c b/liblwgeom/lwcurvepoly.c index 5619a70c9..8a6478c89 100644 --- a/liblwgeom/lwcurvepoly.c +++ b/liblwgeom/lwcurvepoly.c @@ -123,7 +123,7 @@ lwcurvepoly_area(const LWCURVEPOLY *curvepoly) LWPOLY *poly; if( lwgeom_is_empty((LWGEOM*)curvepoly) ) return 0.0; - poly = lwcurvepoly_segmentize(curvepoly, 32); + poly = lwcurvepoly_stroke(curvepoly, 32); area = lwpoly_area(poly); lwpoly_free(poly); return area; diff --git a/liblwgeom/lwgeom.c b/liblwgeom/lwgeom.c index f0db4f4bc..29bba019b 100644 --- a/liblwgeom/lwgeom.c +++ b/liblwgeom/lwgeom.c @@ -758,7 +758,7 @@ lwgeom_force_sfs(LWGEOM *geom, int version) case CURVEPOLYTYPE: case MULTICURVETYPE: case MULTISURFACETYPE: - return lwgeom_segmentize(geom, 32); + return lwgeom_stroke(geom, 32); case COLLECTIONTYPE: col = (LWCOLLECTION*)geom; @@ -782,7 +782,7 @@ lwgeom_force_sfs(LWGEOM *geom, int version) case CURVEPOLYTYPE: case MULTICURVETYPE: case MULTISURFACETYPE: - return lwgeom_segmentize(geom, 32); + return lwgeom_stroke(geom, 32); /* SFS 1.2 types */ case TRIANGLETYPE: diff --git a/liblwgeom/lwsegmentize.c b/liblwgeom/lwstroke.c similarity index 82% rename from liblwgeom/lwsegmentize.c rename to liblwgeom/lwstroke.c index 12b5668ad..04d19cf94 100644 --- a/liblwgeom/lwsegmentize.c +++ b/liblwgeom/lwstroke.c @@ -21,16 +21,16 @@ #include "lwgeom_log.h" -LWMLINE *lwmcurve_segmentize(LWMCURVE *mcurve, uint32_t perQuad); -LWMPOLY *lwmsurface_segmentize(LWMSURFACE *msurface, uint32_t perQuad); -LWCOLLECTION *lwcollection_segmentize(LWCOLLECTION *collection, uint32_t perQuad); +LWMLINE *lwmcurve_stroke(LWMCURVE *mcurve, uint32_t perQuad); +LWMPOLY *lwmsurface_stroke(LWMSURFACE *msurface, uint32_t perQuad); +LWCOLLECTION *lwcollection_stroke(LWCOLLECTION *collection, uint32_t perQuad); -LWGEOM *pta_desegmentize(POINTARRAY *points, int type, int srid); -LWGEOM *lwline_desegmentize(LWLINE *line); -LWGEOM *lwpolygon_desegmentize(LWPOLY *poly); -LWGEOM *lwmline_desegmentize(LWMLINE *mline); -LWGEOM *lwmpolygon_desegmentize(LWMPOLY *mpoly); -LWGEOM *lwgeom_desegmentize(LWGEOM *geom); +LWGEOM *pta_unstroke(POINTARRAY *points, int type, int srid); +LWGEOM *lwline_unstroke(LWLINE *line); +LWGEOM *lwpolygon_unstroke(LWPOLY *poly); +LWGEOM *lwmline_unstroke(LWMLINE *mline); +LWGEOM *lwmpolygon_unstroke(LWMPOLY *mpoly); +LWGEOM *lwgeom_unstroke(LWGEOM *geom); /* @@ -99,7 +99,7 @@ static double interpolate_arc(double angle, double a1, double a2, double a3, dou } static POINTARRAY * -lwcircle_segmentize(POINT4D *p1, POINT4D *p2, POINT4D *p3, uint32_t perQuad) +lwcircle_stroke(POINT4D *p1, POINT4D *p2, POINT4D *p3, uint32_t perQuad) { POINT2D center; POINT2D *t1 = (POINT2D*)p1; @@ -187,7 +187,7 @@ lwcircle_segmentize(POINT4D *p1, POINT4D *p2, POINT4D *p3, uint32_t perQuad) } LWLINE * -lwcircstring_segmentize(const LWCIRCSTRING *icurve, uint32_t perQuad) +lwcircstring_stroke(const LWCIRCSTRING *icurve, uint32_t perQuad) { LWLINE *oline; POINTARRAY *ptarray; @@ -195,22 +195,22 @@ lwcircstring_segmentize(const LWCIRCSTRING *icurve, uint32_t perQuad) uint32_t i, j; POINT4D p1, p2, p3, p4; - LWDEBUGF(2, "lwcircstring_segmentize called., dim = %d", icurve->points->flags); + LWDEBUGF(2, "lwcircstring_stroke called., dim = %d", icurve->points->flags); ptarray = ptarray_construct_empty(FLAGS_GET_Z(icurve->points->flags), FLAGS_GET_M(icurve->points->flags), 64); for (i = 2; i < icurve->points->npoints; i+=2) { - LWDEBUGF(3, "lwcircstring_segmentize: arc ending at point %d", i); + LWDEBUGF(3, "lwcircstring_stroke: arc ending at point %d", i); getPoint4d_p(icurve->points, i - 2, &p1); getPoint4d_p(icurve->points, i - 1, &p2); getPoint4d_p(icurve->points, i, &p3); - tmp = lwcircle_segmentize(&p1, &p2, &p3, perQuad); + tmp = lwcircle_stroke(&p1, &p2, &p3, perQuad); if (tmp) { - LWDEBUGF(3, "lwcircstring_segmentize: generated %d points", tmp->npoints); + LWDEBUGF(3, "lwcircstring_stroke: generated %d points", tmp->npoints); for (j = 0; j < tmp->npoints; j++) { @@ -221,7 +221,7 @@ lwcircstring_segmentize(const LWCIRCSTRING *icurve, uint32_t perQuad) } else { - LWDEBUG(3, "lwcircstring_segmentize: points are colinear, returning curve points as line"); + LWDEBUG(3, "lwcircstring_stroke: points are colinear, returning curve points as line"); for (j = i - 2 ; j < i ; j++) { @@ -239,7 +239,7 @@ lwcircstring_segmentize(const LWCIRCSTRING *icurve, uint32_t perQuad) } LWLINE * -lwcompound_segmentize(const LWCOMPOUND *icompound, uint32_t perQuad) +lwcompound_stroke(const LWCOMPOUND *icompound, uint32_t perQuad) { LWGEOM *geom; POINTARRAY *ptarray = NULL, *ptarray_out = NULL; @@ -247,7 +247,7 @@ lwcompound_segmentize(const LWCOMPOUND *icompound, uint32_t perQuad) uint32_t i, j; POINT4D p; - LWDEBUG(2, "lwcompound_segmentize called."); + LWDEBUG(2, "lwcompound_stroke called."); ptarray = ptarray_construct_empty(FLAGS_GET_Z(icompound->flags), FLAGS_GET_M(icompound->flags), 64); @@ -256,7 +256,7 @@ lwcompound_segmentize(const LWCOMPOUND *icompound, uint32_t perQuad) geom = icompound->geoms[i]; if (geom->type == CIRCSTRINGTYPE) { - tmp = lwcircstring_segmentize((LWCIRCSTRING *)geom, perQuad); + tmp = lwcircstring_stroke((LWCIRCSTRING *)geom, perQuad); for (j = 0; j < tmp->points->npoints; j++) { getPoint4d_p(tmp->points, j, &p); @@ -286,7 +286,7 @@ lwcompound_segmentize(const LWCOMPOUND *icompound, uint32_t perQuad) } LWPOLY * -lwcurvepoly_segmentize(const LWCURVEPOLY *curvepoly, uint32_t perQuad) +lwcurvepoly_stroke(const LWCURVEPOLY *curvepoly, uint32_t perQuad) { LWPOLY *ogeom; LWGEOM *tmp; @@ -294,7 +294,7 @@ lwcurvepoly_segmentize(const LWCURVEPOLY *curvepoly, uint32_t perQuad) POINTARRAY **ptarray; int i; - LWDEBUG(2, "lwcurvepoly_segmentize called."); + LWDEBUG(2, "lwcurvepoly_stroke called."); ptarray = lwalloc(sizeof(POINTARRAY *)*curvepoly->nrings); @@ -303,7 +303,7 @@ lwcurvepoly_segmentize(const LWCURVEPOLY *curvepoly, uint32_t perQuad) tmp = curvepoly->rings[i]; if (tmp->type == CIRCSTRINGTYPE) { - line = lwcircstring_segmentize((LWCIRCSTRING *)tmp, perQuad); + line = lwcircstring_stroke((LWCIRCSTRING *)tmp, perQuad); ptarray[i] = ptarray_clone_deep(line->points); lwline_free(line); } @@ -314,7 +314,7 @@ lwcurvepoly_segmentize(const LWCURVEPOLY *curvepoly, uint32_t perQuad) } else if (tmp->type == COMPOUNDTYPE) { - line = lwcompound_segmentize((LWCOMPOUND *)tmp, perQuad); + line = lwcompound_stroke((LWCOMPOUND *)tmp, perQuad); ptarray[i] = ptarray_clone_deep(line->points); lwline_free(line); } @@ -330,14 +330,14 @@ lwcurvepoly_segmentize(const LWCURVEPOLY *curvepoly, uint32_t perQuad) } LWMLINE * -lwmcurve_segmentize(LWMCURVE *mcurve, uint32_t perQuad) +lwmcurve_stroke(LWMCURVE *mcurve, uint32_t perQuad) { LWMLINE *ogeom; LWGEOM *tmp; LWGEOM **lines; int i; - LWDEBUGF(2, "lwmcurve_segmentize called, geoms=%d, dim=%d.", mcurve->ngeoms, FLAGS_NDIMS(mcurve->flags)); + LWDEBUGF(2, "lwmcurve_stroke called, geoms=%d, dim=%d.", mcurve->ngeoms, FLAGS_NDIMS(mcurve->flags)); lines = lwalloc(sizeof(LWGEOM *)*mcurve->ngeoms); @@ -346,7 +346,7 @@ lwmcurve_segmentize(LWMCURVE *mcurve, uint32_t perQuad) tmp = mcurve->geoms[i]; if (tmp->type == CIRCSTRINGTYPE) { - lines[i] = (LWGEOM *)lwcircstring_segmentize((LWCIRCSTRING *)tmp, perQuad); + lines[i] = (LWGEOM *)lwcircstring_stroke((LWCIRCSTRING *)tmp, perQuad); } else if (tmp->type == LINETYPE) { @@ -354,7 +354,7 @@ lwmcurve_segmentize(LWMCURVE *mcurve, uint32_t perQuad) } else if (tmp->type == COMPOUNDTYPE) { - lines[i] = (LWGEOM *)lwcompound_segmentize((LWCOMPOUND *)tmp, perQuad); + lines[i] = (LWGEOM *)lwcompound_stroke((LWCOMPOUND *)tmp, perQuad); } else { @@ -368,7 +368,7 @@ lwmcurve_segmentize(LWMCURVE *mcurve, uint32_t perQuad) } LWMPOLY * -lwmsurface_segmentize(LWMSURFACE *msurface, uint32_t perQuad) +lwmsurface_stroke(LWMSURFACE *msurface, uint32_t perQuad) { LWMPOLY *ogeom; LWGEOM *tmp; @@ -377,7 +377,7 @@ lwmsurface_segmentize(LWMSURFACE *msurface, uint32_t perQuad) POINTARRAY **ptarray; int i, j; - LWDEBUG(2, "lwmsurface_segmentize called."); + LWDEBUG(2, "lwmsurface_stroke called."); polys = lwalloc(sizeof(LWGEOM *)*msurface->ngeoms); @@ -386,7 +386,7 @@ lwmsurface_segmentize(LWMSURFACE *msurface, uint32_t perQuad) tmp = msurface->geoms[i]; if (tmp->type == CURVEPOLYTYPE) { - polys[i] = (LWGEOM *)lwcurvepoly_segmentize((LWCURVEPOLY *)tmp, perQuad); + polys[i] = (LWGEOM *)lwcurvepoly_stroke((LWCURVEPOLY *)tmp, perQuad); } else if (tmp->type == POLYGONTYPE) { @@ -404,14 +404,14 @@ lwmsurface_segmentize(LWMSURFACE *msurface, uint32_t perQuad) } LWCOLLECTION * -lwcollection_segmentize(LWCOLLECTION *collection, uint32_t perQuad) +lwcollection_stroke(LWCOLLECTION *collection, uint32_t perQuad) { LWCOLLECTION *ocol; LWGEOM *tmp; LWGEOM **geoms; int i; - LWDEBUG(2, "lwcollection_segmentize called."); + LWDEBUG(2, "lwcollection_stroke called."); geoms = lwalloc(sizeof(LWGEOM *)*collection->ngeoms); @@ -421,16 +421,16 @@ lwcollection_segmentize(LWCOLLECTION *collection, uint32_t perQuad) switch (tmp->type) { case CIRCSTRINGTYPE: - geoms[i] = (LWGEOM *)lwcircstring_segmentize((LWCIRCSTRING *)tmp, perQuad); + geoms[i] = (LWGEOM *)lwcircstring_stroke((LWCIRCSTRING *)tmp, perQuad); break; case COMPOUNDTYPE: - geoms[i] = (LWGEOM *)lwcompound_segmentize((LWCOMPOUND *)tmp, perQuad); + geoms[i] = (LWGEOM *)lwcompound_stroke((LWCOMPOUND *)tmp, perQuad); break; case CURVEPOLYTYPE: - geoms[i] = (LWGEOM *)lwcurvepoly_segmentize((LWCURVEPOLY *)tmp, perQuad); + geoms[i] = (LWGEOM *)lwcurvepoly_stroke((LWCURVEPOLY *)tmp, perQuad); break; case COLLECTIONTYPE: - geoms[i] = (LWGEOM *)lwcollection_segmentize((LWCOLLECTION *)tmp, perQuad); + geoms[i] = (LWGEOM *)lwcollection_stroke((LWCOLLECTION *)tmp, perQuad); break; default: geoms[i] = lwgeom_clone(tmp); @@ -442,28 +442,28 @@ lwcollection_segmentize(LWCOLLECTION *collection, uint32_t perQuad) } LWGEOM * -lwgeom_segmentize(LWGEOM *geom, uint32_t perQuad) +lwgeom_stroke(LWGEOM *geom, uint32_t perQuad) { LWGEOM * ogeom = NULL; switch (geom->type) { case CIRCSTRINGTYPE: - ogeom = (LWGEOM *)lwcircstring_segmentize((LWCIRCSTRING *)geom, perQuad); + ogeom = (LWGEOM *)lwcircstring_stroke((LWCIRCSTRING *)geom, perQuad); break; case COMPOUNDTYPE: - ogeom = (LWGEOM *)lwcompound_segmentize((LWCOMPOUND *)geom, perQuad); + ogeom = (LWGEOM *)lwcompound_stroke((LWCOMPOUND *)geom, perQuad); break; case CURVEPOLYTYPE: - ogeom = (LWGEOM *)lwcurvepoly_segmentize((LWCURVEPOLY *)geom, perQuad); + ogeom = (LWGEOM *)lwcurvepoly_stroke((LWCURVEPOLY *)geom, perQuad); break; case MULTICURVETYPE: - ogeom = (LWGEOM *)lwmcurve_segmentize((LWMCURVE *)geom, perQuad); + ogeom = (LWGEOM *)lwmcurve_stroke((LWMCURVE *)geom, perQuad); break; case MULTISURFACETYPE: - ogeom = (LWGEOM *)lwmsurface_segmentize((LWMSURFACE *)geom, perQuad); + ogeom = (LWGEOM *)lwmsurface_stroke((LWMSURFACE *)geom, perQuad); break; case COLLECTIONTYPE: - ogeom = (LWGEOM *)lwcollection_segmentize((LWCOLLECTION *)geom, perQuad); + ogeom = (LWGEOM *)lwcollection_stroke((LWCOLLECTION *)geom, perQuad); break; default: ogeom = lwgeom_clone(geom); @@ -582,7 +582,7 @@ geom_from_pa(const POINTARRAY *pa, int srid, int is_arc, int start, int end) } LWGEOM* -pta_desegmentize(POINTARRAY *points, int type, int srid) +pta_unstroke(POINTARRAY *points, int type, int srid) { int i = 0, j, k; POINT4D a1, a2, a3, b; @@ -599,7 +599,7 @@ pta_desegmentize(POINTARRAY *points, int type, int srid) /* Die on null input */ if ( ! points ) - lwerror("pta_desegmentize called with null pointarray"); + lwerror("pta_unstroke called with null pointarray"); /* Null on empty input? */ if ( points->npoints == 0 ) @@ -609,7 +609,7 @@ pta_desegmentize(POINTARRAY *points, int type, int srid) if ( points->npoints < 4 ) { /* Return a linestring here*/ - lwerror("pta_desegmentize needs implementation for npoints < 4"); + lwerror("pta_unstroke needs implementation for npoints < 4"); } /* Allocate our result array of vertices that are part of arcs */ @@ -744,26 +744,26 @@ pta_desegmentize(POINTARRAY *points, int type, int srid) LWGEOM * -lwline_desegmentize(LWLINE *line) +lwline_unstroke(LWLINE *line) { - LWDEBUG(2, "lwline_desegmentize called."); + LWDEBUG(2, "lwline_unstroke called."); if ( line->points->npoints < 4 ) return lwline_as_lwgeom(lwline_clone(line)); - else return pta_desegmentize(line->points, line->flags, line->srid); + else return pta_unstroke(line->points, line->flags, line->srid); } LWGEOM * -lwpolygon_desegmentize(LWPOLY *poly) +lwpolygon_unstroke(LWPOLY *poly) { LWGEOM **geoms; int i, hascurve = 0; - LWDEBUG(2, "lwpolygon_desegmentize called."); + LWDEBUG(2, "lwpolygon_unstroke called."); geoms = lwalloc(sizeof(LWGEOM *)*poly->nrings); for (i=0; inrings; i++) { - geoms[i] = pta_desegmentize(poly->rings[i], poly->flags, poly->srid); + geoms[i] = pta_unstroke(poly->rings[i], poly->flags, poly->srid); if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE) { hascurve = 1; @@ -782,17 +782,17 @@ lwpolygon_desegmentize(LWPOLY *poly) } LWGEOM * -lwmline_desegmentize(LWMLINE *mline) +lwmline_unstroke(LWMLINE *mline) { LWGEOM **geoms; int i, hascurve = 0; - LWDEBUG(2, "lwmline_desegmentize called."); + LWDEBUG(2, "lwmline_unstroke called."); geoms = lwalloc(sizeof(LWGEOM *)*mline->ngeoms); for (i=0; ingeoms; i++) { - geoms[i] = lwline_desegmentize((LWLINE *)mline->geoms[i]); + geoms[i] = lwline_unstroke((LWLINE *)mline->geoms[i]); if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE) { hascurve = 1; @@ -810,17 +810,17 @@ lwmline_desegmentize(LWMLINE *mline) } LWGEOM * -lwmpolygon_desegmentize(LWMPOLY *mpoly) +lwmpolygon_unstroke(LWMPOLY *mpoly) { LWGEOM **geoms; int i, hascurve = 0; - LWDEBUG(2, "lwmpoly_desegmentize called."); + LWDEBUG(2, "lwmpoly_unstroke called."); geoms = lwalloc(sizeof(LWGEOM *)*mpoly->ngeoms); for (i=0; ingeoms; i++) { - geoms[i] = lwpolygon_desegmentize((LWPOLY *)mpoly->geoms[i]); + geoms[i] = lwpolygon_unstroke((LWPOLY *)mpoly->geoms[i]); if (geoms[i]->type == CURVEPOLYTYPE) { hascurve = 1; @@ -838,20 +838,20 @@ lwmpolygon_desegmentize(LWMPOLY *mpoly) } LWGEOM * -lwgeom_desegmentize(LWGEOM *geom) +lwgeom_unstroke(LWGEOM *geom) { - LWDEBUG(2, "lwgeom_desegmentize called."); + LWDEBUG(2, "lwgeom_unstroke called."); switch (geom->type) { case LINETYPE: - return lwline_desegmentize((LWLINE *)geom); + return lwline_unstroke((LWLINE *)geom); case POLYGONTYPE: - return lwpolygon_desegmentize((LWPOLY *)geom); + return lwpolygon_unstroke((LWPOLY *)geom); case MULTILINETYPE: - return lwmline_desegmentize((LWMLINE *)geom); + return lwmline_unstroke((LWMLINE *)geom); case MULTIPOLYGONTYPE: - return lwmpolygon_desegmentize((LWMPOLY *)geom); + return lwmpolygon_unstroke((LWMPOLY *)geom); default: return lwgeom_clone(geom); } diff --git a/postgis/lwgeom_sqlmm.c b/postgis/lwgeom_sqlmm.c index 7ca8934c7..af5924976 100644 --- a/postgis/lwgeom_sqlmm.c +++ b/postgis/lwgeom_sqlmm.c @@ -68,7 +68,7 @@ Datum LWGEOM_curve_segmentize(PG_FUNCTION_ARGS) POSTGIS_DEBUGF(3, "perQuad = %d", perQuad); igeom = lwgeom_from_gserialized(geom); - ogeom = lwgeom_segmentize(igeom, perQuad); + ogeom = lwgeom_stroke(igeom, perQuad); lwgeom_free(igeom); if (ogeom == NULL) @@ -90,7 +90,7 @@ Datum LWGEOM_line_desegmentize(PG_FUNCTION_ARGS) POSTGIS_DEBUG(2, "LWGEOM_line_desegmentize."); igeom = lwgeom_from_gserialized(geom); - ogeom = lwgeom_desegmentize(igeom); + ogeom = lwgeom_unstroke(igeom); lwgeom_free(igeom); if (ogeom == NULL)