[postgis-tickets] [SCM] PostGIS branch master updated. 3.3.0rc1-30-ge87cf16e6

git at osgeo.org git at osgeo.org
Wed Aug 17 12:08:34 PDT 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  e87cf16e6220a69a868540a1b4ef303fd8a9dcf2 (commit)
      from  eec975ea5bec2390c986b0813cc3493fd09832bb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e87cf16e6220a69a868540a1b4ef303fd8a9dcf2
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Aug 17 12:08:29 2022 -0700

    ST_Reverse must reverse components of CompoundCurve to retain valid structure, #5089

diff --git a/NEWS b/NEWS
index 05f7eac48..0b11040a8 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,9 @@ Additional features are enabled if you are running GEOS 3.9+
 ST_MakeValid enhancements with 3.10+, numerouse additional enhancements with GEOS 3.11+.
 Requires SFCGAL 1.4.1+ for ST_AlphaShape and ST_OptimalAlphaShape.
 
+  - #5089, ST_Reverse also reverses components of CompoundCurve (Paul Ramsey)
+
+
 PostGIS 3.3.0rc1
 2022/08/08
 This version requires PostgreSQL 11 or higher, GEOS 3.6 or higher, and Proj 5.2+.
diff --git a/liblwgeom/lwgeom.c b/liblwgeom/lwgeom.c
index b5d022d1c..e5f6fdb57 100644
--- a/liblwgeom/lwgeom.c
+++ b/liblwgeom/lwgeom.c
@@ -132,6 +132,24 @@ lwgeom_reverse_in_place(LWGEOM *geom)
 				ptarray_reverse_in_place(poly->rings[r]);
 			return;
 		}
+		/* CompoundCurve needs to also reverse the sub-geometries */
+		/* so that the end-points remain coincident */
+		case COMPOUNDTYPE:
+		{
+			uint32_t ngeoms;
+			col = (LWCOLLECTION *)(geom);
+			if (!col->geoms)
+				return;
+			ngeoms = col->ngeoms;
+			for (i=0; i<ngeoms; i++)
+				lwgeom_reverse_in_place(col->geoms[i]);
+			for (i=0; i<col->ngeoms/2; i++) {
+				LWGEOM* tmp = col->geoms[i];
+				col->geoms[i] = col->geoms[ngeoms-i-1];
+				col->geoms[ngeoms-i-1] = tmp;
+			}
+			return;
+		}
 		case MULTICURVETYPE:
 		case MULTILINETYPE:
 		case MULTIPOLYGONTYPE:
@@ -139,7 +157,6 @@ lwgeom_reverse_in_place(LWGEOM *geom)
 		case POLYHEDRALSURFACETYPE:
 		case TINTYPE:
 		case COLLECTIONTYPE:
-		case COMPOUNDTYPE:
 		case CURVEPOLYTYPE:
 		{
 			col = (LWCOLLECTION *)(geom);
diff --git a/regress/core/reverse_expected b/regress/core/reverse_expected
index 15b44fbc4..87b44bed4 100644
--- a/regress/core/reverse_expected
+++ b/regress/core/reverse_expected
@@ -24,16 +24,16 @@ cstr2|CIRCULARSTRING(4 0,3 -1,2 0,1 1,0 0)
 cstr2m|CIRCULARSTRING M (4 0 5,3 -1 4,2 0 3,1 1 2,0 0 1)
 cstr2z|CIRCULARSTRING Z (4 0 5,3 -1 4,2 0 3,1 1 2,0 0 1)
 ccrv1|COMPOUNDCURVE EMPTY
-ccrv2|COMPOUNDCURVE(CIRCULARSTRING(1 0,1 1,0 0),(0 1,1 0))
-ccrv2m|COMPOUNDCURVE M (CIRCULARSTRING M (1 0 1,1 1 2,0 0 3),(0 1 7,1 0 6))
-ccrv2z|COMPOUNDCURVE Z (CIRCULARSTRING Z (1 0 1,1 1 2,0 0 3),(0 1 7,1 0 6))
+ccrv2|COMPOUNDCURVE((0 1,1 0),CIRCULARSTRING(1 0,1 1,0 0))
+ccrv2m|COMPOUNDCURVE M ((0 1 7,1 0 6),CIRCULARSTRING M (1 0 1,1 1 2,0 0 3))
+ccrv2z|COMPOUNDCURVE Z ((0 1 7,1 0 6),CIRCULARSTRING Z (1 0 1,1 1 2,0 0 3))
 cplg1|CURVEPOLYGON EMPTY
-cplg2|CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(1 0,1 1,0 0),(0 1,1 0),(0 0,0 1)))
-cplg2m|CURVEPOLYGON M (COMPOUNDCURVE M (CIRCULARSTRING M (1 0 2,1 1 2,0 0 2),(0 1 2,1 0 2),(0 0 2,0 1 2)))
-cplg2z|CURVEPOLYGON Z (COMPOUNDCURVE Z (CIRCULARSTRING Z (1 0 2,1 1 2,0 0 2),(0 1 2,1 0 2),(0 0 2,0 1 2)))
+cplg2|CURVEPOLYGON(COMPOUNDCURVE((0 0,0 1),(0 1,1 0),CIRCULARSTRING(1 0,1 1,0 0)))
+cplg2m|CURVEPOLYGON M (COMPOUNDCURVE M ((0 0 2,0 1 2),(0 1 2,1 0 2),CIRCULARSTRING M (1 0 2,1 1 2,0 0 2)))
+cplg2z|CURVEPOLYGON Z (COMPOUNDCURVE Z ((0 0 2,0 1 2),(0 1 2,1 0 2),CIRCULARSTRING Z (1 0 2,1 1 2,0 0 2)))
 mc1|MULTICURVE EMPTY
-mc2|MULTICURVE((0 3,3 3,3 5,5 5),CIRCULARSTRING(0.5 1.4,0.2 1,0 0),COMPOUNDCURVE(CIRCULARSTRING(1 0,1 1,0 0),(0 1,1 0)))
-mc2zm|MULTICURVE ZM ((0 3 9 8,3 3 7 5,3 5 2 3,5 5 0 1),CIRCULARSTRING ZM (0.5 1.4 5 1,0.2 1 4 2,0 0 1 3),COMPOUNDCURVE ZM (CIRCULARSTRING ZM (1 0 5 6,1 1 0 4,0 0 -1 -2),(0 1 3 4,1 0 4 2)))
+mc2|MULTICURVE((0 3,3 3,3 5,5 5),CIRCULARSTRING(0.5 1.4,0.2 1,0 0),COMPOUNDCURVE((0 1,1 0),CIRCULARSTRING(1 0,1 1,0 0)))
+mc2zm|MULTICURVE ZM ((0 3 9 8,3 3 7 5,3 5 2 3,5 5 0 1),CIRCULARSTRING ZM (0.5 1.4 5 1,0.2 1 4 2,0 0 1 3),COMPOUNDCURVE ZM ((0 1 3 4,1 0 4 2),CIRCULARSTRING ZM (1 0 5 6,1 1 0 4,0 0 -1 -2)))
 ms1|MULTISURFACE EMPTY
 ms2|MULTISURFACE(CURVEPOLYGON(CIRCULARSTRING(-2 0,0 2,2 0,1 -1,0 0,-1 -1,-2 0),(-1 0,0 1,1 0,0 0.5,-1 0)),((7 8,4 11,6 14,10 10,7 8)))
 ms2m|MULTISURFACE M (CURVEPOLYGON M (CIRCULARSTRING M (-2 0 0,0 2 2,2 0 4,1 -1 3,0 0 2,-1 -1 1,-2 0 0),(-1 0 1,0 1 3,1 0 3,0 0.5 2,-1 0 1)),((7 8 7,4 11 4,6 14 3,10 10 5,7 8 7)))

-----------------------------------------------------------------------

Summary of changes:
 NEWS                          |  3 +++
 liblwgeom/lwgeom.c            | 19 ++++++++++++++++++-
 regress/core/reverse_expected | 16 ++++++++--------
 3 files changed, 29 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list