[mapserver-commits] r10658 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Sat Oct 23 21:21:11 EDT 2010


Author: warmerdam
Date: 2010-10-23 18:21:11 -0700 (Sat, 23 Oct 2010)
New Revision: 10658

Modified:
   trunk/mapserver/mapogroutput.c
Log:
added support for multilinestrings (#3570)

Modified: trunk/mapserver/mapogroutput.c
===================================================================
--- trunk/mapserver/mapogroutput.c	2010-10-24 01:20:45 UTC (rev 10657)
+++ trunk/mapserver/mapogroutput.c	2010-10-24 01:21:11 UTC (rev 10658)
@@ -221,7 +221,10 @@
 /* -------------------------------------------------------------------- */
     else if(  shape->type == MS_SHAPE_LINE )
     {
-        if( shape->numlines != 1 || shape->line[0].numpoints < 2 )
+        OGRGeometryH hML = NULL;
+        int j;
+
+        if( shape->numlines < 1 || shape->line[0].numpoints < 2 )
         {
             msSetError(MS_MISCERR, 
                        "Failed on odd line geometry.", 
@@ -229,14 +232,26 @@
             return MS_FAILURE;
         }
 
-        hGeom = OGR_G_CreateGeometry( wkbLineString );
+        if( shape->numlines > 1 )
+            hML = OGR_G_CreateGeometry( wkbMultiLineString );
+
+        for( j = 0; j < shape->numlines; j++ )
+        {
+            hGeom = OGR_G_CreateGeometry( wkbLineString );
         
-        for( i = 0; i < shape->line[0].numpoints; i++ )
-        {
-            OGR_G_SetPoint( hGeom, i, 
-                            shape->line[0].point[i].x,
-                            shape->line[0].point[i].y,
-                            0.0 );
+            for( i = 0; i < shape->line[j].numpoints; i++ )
+            {
+                OGR_G_SetPoint( hGeom, i, 
+                                shape->line[j].point[i].x,
+                                shape->line[j].point[i].y,
+                                0.0 );
+            }
+
+            if( hML != NULL )
+            {
+                OGR_G_AddGeometryDirectly( hML, hGeom );
+                hGeom = hML;
+            }
         }
     }
 
@@ -730,6 +745,8 @@
 /* -------------------------------------------------------------------- */
         for(i=0; i < layer->resultcache->numresults; i++) {
 
+            msFreeShape(&resultshape); /* init too */
+
             /*
             ** Read the shape.
             */



More information about the mapserver-commits mailing list