[mapserver-commits] r9764 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Wed Jan 27 14:21:00 EST 2010


Author: aboudreault
Date: 2010-01-27 14:20:56 -0500 (Wed, 27 Jan 2010)
New Revision: 9764

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapshape.c
Log:
Added support to write a null shape in a shape file. (#3277)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2010-01-27 18:21:58 UTC (rev 9763)
+++ trunk/mapserver/HISTORY.TXT	2010-01-27 19:20:56 UTC (rev 9764)
@@ -14,6 +14,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Added support to write a null shape in a shape file. (#3277)
+
 - Apply ON_MISSING_DATA to zero-length WMS client calls (#2785, #3243)
 
 - PHP/Mapscript: added labelCacheMember object and mapObj::getLabel() method (#1794)

Modified: trunk/mapserver/mapshape.c
===================================================================
--- trunk/mapserver/mapshape.c	2010-01-27 18:21:58 UTC (rev 9763)
+++ trunk/mapserver/mapshape.c	2010-01-27 19:20:56 UTC (rev 9764)
@@ -658,6 +658,8 @@
 {
   int nRecordOffset, i, j, k, nRecordSize=0;
   uchar	*pabyRec;
+  int nShapeType;
+
   ms_int32	i32, nPoints, nParts;
 #ifdef USE_POINT_Z_M
   double dfMMin, dfMMax = 0;
@@ -693,12 +695,16 @@
   psSHP->panRecOffset[psSHP->nRecords-1] = nRecordOffset = psSHP->nFileSize;
   
   pabyRec = (uchar *) malloc(nPoints * 4 * sizeof(double) + nParts * 8 + 128);
+  nShapeType = psSHP->nShapeType;
   
-  
+  if (shape->type == MS_SHAPE_NULL) {
+      nShapeType = 0;
+      nRecordSize = 12;
+  }
   /* -------------------------------------------------------------------- */
   /*  Write vertices for a Polygon or Arc.				    */
   /* -------------------------------------------------------------------- */
-  if(psSHP->nShapeType == SHP_POLYGON || psSHP->nShapeType == SHP_ARC ||
+  else if(psSHP->nShapeType == SHP_POLYGON || psSHP->nShapeType == SHP_ARC ||
      psSHP->nShapeType == SHP_POLYGONM || psSHP->nShapeType == SHP_ARCM ||
      psSHP->nShapeType == SHP_ARCZ ||  psSHP->nShapeType == SHP_POLYGONZ) {
     ms_int32 t_nParts, t_nPoints, partSize;
@@ -919,7 +925,7 @@
   if( !bBigEndian ) i32 = SWAP_FOUR_BYTES(i32);
   ByteCopy( &i32, pabyRec + 4, 4 );
   
-  i32 = psSHP->nShapeType;				/* shape type */
+  i32 = nShapeType;     /* shape type */
   if( bBigEndian ) i32 = SWAP_FOUR_BYTES(i32);
   ByteCopy( &i32, pabyRec + 8, 4 );
   



More information about the mapserver-commits mailing list