[mapserver-commits] r12678 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Wed Oct 19 14:09:00 EDT 2011


Author: dmorissette
Date: 2011-10-19 11:09:00 -0700 (Wed, 19 Oct 2011)
New Revision: 12678

Modified:
   trunk/mapserver/mapogroutput.c
Log:
Add support for multipoint output (#4053)

Modified: trunk/mapserver/mapogroutput.c
===================================================================
--- trunk/mapserver/mapogroutput.c	2011-10-19 15:14:39 UTC (rev 12677)
+++ trunk/mapserver/mapogroutput.c	2011-10-19 18:09:00 UTC (rev 12678)
@@ -226,7 +226,10 @@
 /* -------------------------------------------------------------------- */
     if( shape->type == MS_SHAPE_POINT )
     {
-        if( shape->numlines != 1 || shape->line[0].numpoints != 1 )
+        OGRGeometryH hMP = NULL;
+        int j;
+
+        if( shape->numlines < 1 )
         {
             msSetError(MS_MISCERR, 
                        "Failed on odd point geometry.", 
@@ -234,16 +237,36 @@
             return MS_FAILURE;
         }
 
-        hGeom = OGR_G_CreateGeometry( wkbPoint );
-        OGR_G_SetPoint( hGeom, 0, 
-                        shape->line[0].point[0].x,
-                        shape->line[0].point[0].y,
+        if( shape->numlines > 1 )
+            hMP = OGR_G_CreateGeometry( wkbMultiPoint );
+
+        for( j = 0; j < shape->numlines; j++ )
+        {
+            if( shape->line[j].numpoints != 1 )
+            {
+                msSetError(MS_MISCERR, 
+                           "Failed on odd point geometry.", 
+                           "msOGRWriteShape()");
+                return MS_FAILURE;
+            }
+
+            hGeom = OGR_G_CreateGeometry( wkbPoint );
+            OGR_G_SetPoint( hGeom, 0, 
+                            shape->line[j].point[0].x,
+                            shape->line[j].point[0].y,
 #ifdef USE_POINT_Z_M
-                        shape->line[0].point[0].z
+                            shape->line[j].point[0].z
 #else
-                        0.0
+                            0.0
 #endif
-                        );
+                            );
+
+            if( hMP != NULL )
+            {
+                OGR_G_AddGeometryDirectly( hMP, hGeom );
+                hGeom = hMP;
+            }
+        }
     }
 
 /* -------------------------------------------------------------------- */



More information about the mapserver-commits mailing list