]> granicus.if.org Git - postgis/commitdiff
Fix ST_Multi with COMPOUNDCURVE and CURVEPOLYGON types (#2415)
authorSandro Santilli <strk@keybit.net>
Fri, 9 Aug 2013 06:59:55 +0000 (06:59 +0000)
committerSandro Santilli <strk@keybit.net>
Fri, 9 Aug 2013 06:59:55 +0000 (06:59 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@11754 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/lwgeom.c
postgis/lwgeom_functions_basic.c
regress/tickets.sql
regress/tickets_expected

index 0bff0198dcba5d95ea1639554222daa53c0a4595..55a5ccd56faf6b7d767239a014014cee0ad8b66a 100644 (file)
@@ -288,15 +288,6 @@ lwgeom_as_multi(const LWGEOM *lwgeom)
        GBOX *box = NULL;
        int type;
 
-       /*
-       ** This funx is a no-op only if a bbox cache is already present
-       ** in input.
-       */
-       if ( lwgeom_is_collection(lwgeom) )
-       {
-               return lwgeom_clone(lwgeom);
-       }
-
        type = lwgeom->type;
 
        if ( ! MULTITYPE[type] ) return lwgeom_clone(lwgeom);
index a9de2a1f62db634cd68a5bd2a97d8d947630a7dc..bb975e99115a20fa8da0353a8b30b2154e873e6c 100644 (file)
@@ -492,10 +492,20 @@ Datum LWGEOM_force_multi(PG_FUNCTION_ARGS)
        ** in input. If bbox cache is not there we'll need to handle
        ** automatic bbox addition FOR_COMPLEX_GEOMS.
        */
-       if ( lwtype_is_collection(gserialized_get_type(geom)) && 
-            gserialized_has_bbox(geom) )
-       {
-               PG_RETURN_POINTER(geom);
+       if ( gserialized_has_bbox(geom) ) {
+               switch (gserialized_get_type(geom)) 
+               {
+                       case MULTIPOINTTYPE:
+                       case MULTILINETYPE:
+                       case MULTIPOLYGONTYPE:
+                       case COLLECTIONTYPE:
+                       case MULTICURVETYPE:
+                       case MULTISURFACETYPE:
+                       case TINTYPE:
+                               PG_RETURN_POINTER(geom);
+                       default:
+                               break;
+               }
        }
 
        /* deserialize into lwgeoms[0] */
index 45c49a68934f0828ac146a4436447720577a025d..9ef843a00d6a5ffa1f5e156dc7f6fe2d2e1379cd 100644 (file)
@@ -822,5 +822,12 @@ round(ST_Length(St_Segmentize(ST_GeographyFromText('LINESTRING(-89.3000030518 28
 -- #2307 --
 SELECT '#2307', ST_AsText(ST_SnapToGrid(ST_MakeValid('0106000020E6100000010000000103000000010000000A0000004B7DA956B99844C0DB0790FE8B4D1DC010BA74A9AF9444C049AFFC5B8C4D1DC03FC6CC690D9844C0DD67E5628C4D1DC07117B56B0D9844C0C80ABA67C45E1DC0839166ABAF9444C0387D4568C45E1DC010BA74A9AF9444C049AFFC5B8C4D1DC040C3CD74169444C0362EC0608C4D1DC07C1A3B77169444C0DC3ADB40B2641DC03AAE5F68B99844C0242948DEB1641DC04B7DA956B99844C0DB0790FE8B4D1DC0'::geometry),0.0001));
 
+SELECT '#2415.1', ST_AsText(ST_Multi(
+  'COMPOUNDCURVE((0 0, 10 0),CIRCULARSTRING(10 0, 15 1, 20 10))'
+));
+SELECT '#2415.2', ST_AsText(ST_Multi(
+  'CURVEPOLYGON(CIRCULARSTRING(10 0,15 1,20 0,18 5,20 10,10 10,10 0))'
+));
+
 -- Clean up
 DELETE FROM spatial_ref_sys;
index 85f7632395e1a65cb3f64e22b749311f0929064a..80fe3d652038299909b651245188d5a1ea11dc00 100644 (file)
@@ -244,3 +244,5 @@ ERROR:  invalid GML representation
 #2110.3|t
 #2145|6792004
 #2307|MULTIPOLYGON(((-41.1932 -7.3257,-41.1616 -7.3257,-41.1569 -7.3257,-41.1569 -7.3483,-41.1932 -7.3483,-41.1932 -7.3257),(-41.1616 -7.3257,-41.1879 -7.3257,-41.1879 -7.3425,-41.1616 -7.3425,-41.1616 -7.3257)))
+#2415.1|MULTICURVE(COMPOUNDCURVE((0 0,10 0),CIRCULARSTRING(10 0,15 1,20 10)))
+#2415.2|MULTISURFACE(CURVEPOLYGON(CIRCULARSTRING(10 0,15 1,20 0,18 5,20 10,10 10,10 0)))