[postgis-tickets] r16127 - Allow multi-linestring to be used as blade in line/poly splitting,

Paul Ramsey pramsey at cleverelephant.ca
Thu Nov 30 11:18:03 PST 2017


Author: pramsey
Date: 2017-11-30 11:18:03 -0800 (Thu, 30 Nov 2017)
New Revision: 16127

Modified:
   trunk/liblwgeom/lwgeom_geos_split.c
Log:
Allow multi-linestring to be used as blade in line/poly splitting,
References #3097


Modified: trunk/liblwgeom/lwgeom_geos_split.c
===================================================================
--- trunk/liblwgeom/lwgeom_geos_split.c	2017-11-29 22:53:00 UTC (rev 16126)
+++ trunk/liblwgeom/lwgeom_geos_split.c	2017-11-30 19:18:03 UTC (rev 16127)
@@ -34,7 +34,7 @@
 static LWGEOM* lwline_split_by_point(const LWLINE* lwgeom_in, const LWPOINT* blade_in);
 static LWGEOM* lwline_split_by_mpoint(const LWLINE* lwgeom_in, const LWMPOINT* blade_in);
 static LWGEOM* lwline_split(const LWLINE* lwgeom_in, const LWGEOM* blade_in);
-static LWGEOM* lwpoly_split_by_line(const LWPOLY* lwgeom_in, const LWLINE* blade_in);
+static LWGEOM* lwpoly_split_by_line(const LWPOLY* lwgeom_in, const LWGEOM* blade_in);
 static LWGEOM* lwcollection_split(const LWCOLLECTION* lwcoll_in, const LWGEOM* blade_in);
 static LWGEOM* lwpoly_split(const LWPOLY* lwpoly_in, const LWGEOM* blade_in);
 
@@ -342,7 +342,7 @@
 
 /* Initializes and uses GEOS internally */
 static LWGEOM*
-lwpoly_split_by_line(const LWPOLY* lwpoly_in, const LWLINE* blade_in)
+lwpoly_split_by_line(const LWPOLY* lwpoly_in, const LWGEOM* blade_in)
 {
 	LWCOLLECTION* out;
 	GEOSGeometry* g1;
@@ -378,7 +378,7 @@
 		return NULL;
 	}
 
-	g2 = LWGEOM2GEOS((LWGEOM*)blade_in, 0);
+	g2 = LWGEOM2GEOS(blade_in, 0);
 	if ( NULL == g2 )
 	{
 		GEOSGeom_destroy(g1);
@@ -547,8 +547,9 @@
 {
 	switch (blade_in->type)
 	{
+	case MULTILINETYPE:
 	case LINETYPE:
-		return lwpoly_split_by_line(lwpoly_in, (LWLINE*)blade_in);
+		return lwpoly_split_by_line(lwpoly_in, blade_in);
 	default:
 		lwerror("Splitting a Polygon by a %s is unsupported",
 		        lwtype_name(blade_in->type));



More information about the postgis-tickets mailing list