From 6e5a64ab2dacc55b54fa1498470af6900c6bc5dd Mon Sep 17 00:00:00 2001 From: Darafei Praliaskouski Date: Thu, 22 Feb 2018 11:09:37 +0000 Subject: [PATCH] Fix cast from box3d to geometry Patch by Matthias Bay Closes https://github.com/postgis/postgis/pull/214 Closes #4020 git-svn-id: http://svn.osgeo.org/postgis/trunk@16405 b70326c6-7e19-0410-871a-916f4a2858ee --- NEWS | 2 ++ postgis/lwgeom_box3d.c | 6 +++--- regress/regress_expected | 2 +- regress/sfcgal/regress_expected | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 9696f6773..5e54a46c9 100644 --- a/NEWS +++ b/NEWS @@ -39,6 +39,8 @@ PostGIS 2.5.0 (Darafei Praliaskouski) - #3986, ST_AsText now has second argument to limit decimal digits (Marc Ducobu, Darafei Praliaskouski) + - #4020, Casting from box3d to geometry now returns correctly connected + PolyhedralSurface (Matthias Bay) PostGIS 2.4.0 2017/09/30 diff --git a/postgis/lwgeom_box3d.c b/postgis/lwgeom_box3d.c index 73cfc2acd..2ec4a994e 100644 --- a/postgis/lwgeom_box3d.c +++ b/postgis/lwgeom_box3d.c @@ -326,10 +326,10 @@ Datum BOX3D_to_LWGEOM(PG_FUNCTION_ARGS) &points[0], &points[1], &points[2], &points[3])); /* add top polygon */ geoms[1] = lwpoly_as_lwgeom(lwpoly_construct_rectangle(LW_TRUE, LW_FALSE, - &points[4], &points[5], &points[6], &points[7])); + &points[4], &points[7], &points[6], &points[5])); /* add left polygon */ geoms[2] = lwpoly_as_lwgeom(lwpoly_construct_rectangle(LW_TRUE, LW_FALSE, - &points[0], &points[1], &points[5], &points[4])); + &points[0], &points[4], &points[5], &points[1])); /* add right polygon */ geoms[3] = lwpoly_as_lwgeom(lwpoly_construct_rectangle(LW_TRUE, LW_FALSE, &points[3], &points[2], &points[6], &points[7])); @@ -338,7 +338,7 @@ Datum BOX3D_to_LWGEOM(PG_FUNCTION_ARGS) &points[0], &points[3], &points[7], &points[4])); /* add front polygon */ geoms[5] = lwpoly_as_lwgeom(lwpoly_construct_rectangle(LW_TRUE, LW_FALSE, - &points[1], &points[2], &points[6], &points[5])); + &points[1], &points[5], &points[6], &points[2])); geom = (LWGEOM *) lwcollection_construct(POLYHEDRALSURFACETYPE, SRID_UNKNOWN, NULL, ngeoms, geoms); diff --git a/regress/regress_expected b/regress/regress_expected index 8840060f2..3be8ce29f 100644 --- a/regress/regress_expected +++ b/regress/regress_expected @@ -92,7 +92,7 @@ ERROR: parse error - invalid geometry at character 23 107c|POLYGON((2 3 5,2 8 5,6 8 5,6 3 5,2 3 5)) 107d|POLYGON((1 -1 4,2 -1 4,2 -1 9,1 -1 9,1 -1 4)) 107e|POLYGON((-1 3 5,-1 6 5,-1 6 8,-1 3 8,-1 3 5)) -107f|POLYHEDRALSURFACE(((1 2 3,1 5 3,4 5 3,4 2 3,1 2 3)),((1 2 6,1 5 6,4 5 6,4 2 6,1 2 6)),((1 2 3,1 5 3,1 5 6,1 2 6,1 2 3)),((4 2 3,4 5 3,4 5 6,4 2 6,4 2 3)),((1 2 3,4 2 3,4 2 6,1 2 6,1 2 3)),((1 5 3,4 5 3,4 5 6,1 5 6,1 5 3))) +107f|POLYHEDRALSURFACE(((1 2 3,1 5 3,4 5 3,4 2 3,1 2 3)),((1 2 6,4 2 6,4 5 6,1 5 6,1 2 6)),((1 2 3,1 2 6,1 5 6,1 5 3,1 2 3)),((4 2 3,4 5 3,4 5 6,4 2 6,4 2 3)),((1 2 3,4 2 3,4 2 6,1 2 6,1 2 3)),((1 5 3,1 5 6,4 5 6,4 5 3,1 5 3))) 108|2 109|4 110|6 diff --git a/regress/sfcgal/regress_expected b/regress/sfcgal/regress_expected index 3fc4d1db4..308f3b252 100644 --- a/regress/sfcgal/regress_expected +++ b/regress/sfcgal/regress_expected @@ -121,7 +121,7 @@ ERROR: parse error - invalid geometry at character 23 107c|POLYGON((2 3 5,2 8 5,6 8 5,6 3 5,2 3 5)) 107d|POLYGON((1 -1 4,2 -1 4,2 -1 9,1 -1 9,1 -1 4)) 107e|POLYGON((-1 3 5,-1 6 5,-1 6 8,-1 3 8,-1 3 5)) -107f|POLYHEDRALSURFACE(((1 2 3,1 5 3,4 5 3,4 2 3,1 2 3)),((1 2 6,1 5 6,4 5 6,4 2 6,1 2 6)),((1 2 3,1 5 3,1 5 6,1 2 6,1 2 3)),((4 2 3,4 5 3,4 5 6,4 2 6,4 2 3)),((1 2 3,4 2 3,4 2 6,1 2 6,1 2 3)),((1 5 3,4 5 3,4 5 6,1 5 6,1 5 3))) +107f|POLYHEDRALSURFACE(((1 2 3,1 5 3,4 5 3,4 2 3,1 2 3)),((1 2 6,4 2 6,4 5 6,1 5 6,1 2 6)),((1 2 3,1 2 6,1 5 6,1 5 3,1 2 3)),((4 2 3,4 5 3,4 5 6,4 2 6,4 2 3)),((1 2 3,4 2 3,4 2 6,1 2 6,1 2 3)),((1 5 3,1 5 6,4 5 6,4 5 3,1 5 3))) 108|2 109|4 110|6 -- 2.40.0