[mapserver-commits] r11848 - branches/branch-6-0/mapserver

svn at osgeo.org svn at osgeo.org
Mon Jun 27 10:40:00 EDT 2011


Author: dmorissette
Date: 2011-06-27 07:40:00 -0700 (Mon, 27 Jun 2011)
New Revision: 11848

Modified:
   branches/branch-6-0/mapserver/HISTORY.TXT
   branches/branch-6-0/mapserver/mapfile.c
Log:
Added writing of cluster object when saving map. Also improved handling of cluster parsing errors (#3934)

Modified: branches/branch-6-0/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-6-0/mapserver/HISTORY.TXT	2011-06-23 13:34:53 UTC (rev 11847)
+++ branches/branch-6-0/mapserver/HISTORY.TXT	2011-06-27 14:40:00 UTC (rev 11848)
@@ -15,6 +15,9 @@
 Version 6.0.1 (SVN branch-6-0):
 ---------------------------
 
+- Added writing of cluster object when saving map. Also improved handling of
+  cluster parsing errors (#3934)
+
 - Fix for the cluster processing if the shape bounds doesn't overlap 
   with the given extent (#3913)
 

Modified: branches/branch-6-0/mapserver/mapfile.c
===================================================================
--- branches/branch-6-0/mapserver/mapfile.c	2011-06-23 13:34:53 UTC (rev 11847)
+++ branches/branch-6-0/mapserver/mapfile.c	2011-06-27 14:40:00 UTC (rev 11848)
@@ -2305,6 +2305,14 @@
     case(FILTER):
       if(loadExpression(&(cluster->filter)) == -1) return(-1);
       break;
+    default:
+      if(strlen(msyystring_buffer) > 0) {
+        msSetError(MS_IDENTERR, "Parsing error near (%s):(line %d)", "loadCluster()", msyystring_buffer, msyylineno);
+        return(-1);
+      } else {
+        return(0); /* end of a string, not an error */
+      }
+
     }
   }
   return(MS_SUCCESS);
@@ -2333,10 +2341,18 @@
 }
 
 static void writeCluster(FILE *stream, int indent, clusterObj *cluster) {
+
+  if (cluster->maxdistance == 10 &&
+      cluster->buffer == 0.0 &&
+      cluster->region == NULL &&
+      cluster->group.string == NULL &&
+      cluster->filter.string == NULL)
+    return;  /* Nothing to write */
+
   indent++;
   writeBlockBegin(stream, indent, "CLUSTER");
-  writeNumber(stream, indent, "MAXDISTANCE", 0, cluster->maxdistance);
-  writeNumber(stream, indent, "BUFFER", 0, cluster->maxdistance);
+  writeNumber(stream, indent, "MAXDISTANCE", 10, cluster->maxdistance);
+  writeNumber(stream, indent, "BUFFER", 0, cluster->buffer);
   writeString(stream, indent, "REGION", NULL, cluster->region);
   writeExpression(stream, indent, "GROUP", &(cluster->group));
   writeExpression(stream, indent, "FILTER", &(cluster->filter));
@@ -3963,6 +3979,7 @@
   /* class - see below */
   writeString(stream, indent, "CLASSGROUP", NULL, layer->classgroup);
   writeString(stream, indent, "CLASSITEM", NULL, layer->classitem);
+  writeCluster(stream, indent, &(layer->cluster));
   writeString(stream, indent, "CONNECTION", NULL, layer->connection);
   writeKeyword(stream, indent, "CONNECTIONTYPE", layer->connectiontype, 9, MS_SDE, "SDE", MS_OGR, "OGR", MS_POSTGIS, "POSTGIS", MS_WMS, "WMS", MS_ORACLESPATIAL, "ORACLESPATIAL", MS_WFS, "WFS", MS_GRATICULE, "GRATICULE", MS_PLUGIN, "PLUGIN", MS_UNION, "UNION");
   writeString(stream, indent, "DATA", NULL, layer->data);



More information about the mapserver-commits mailing list