[mapserver-commits] r10120 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Sun Apr 25 23:46:01 EDT 2010


Author: sdlime
Date: 2010-04-25 23:46:00 -0400 (Sun, 25 Apr 2010)
New Revision: 10120

Modified:
   trunk/mapserver/mapfile.c
Log:
Checking all the writeXXX() functions to make sure they match what can be read. Took care of writeQueryMap().

Modified: trunk/mapserver/mapfile.c
===================================================================
--- trunk/mapserver/mapfile.c	2010-04-25 23:12:26 UTC (rev 10119)
+++ trunk/mapserver/mapfile.c	2010-04-26 03:46:00 UTC (rev 10120)
@@ -73,7 +73,7 @@
 static char *msLayerTypes[9]={"POINT", "LINE", "POLYGON", "RASTER", "ANNOTATION", "QUERY", "CIRCLE", "TILEINDEX","CHART"};
 char *msPositionsText[MS_POSITIONS_LENGTH] = {"UL", "LR", "UR", "LL", "CR", "CL", "UC", "LC", "CC", "AUTO", "XY", "FOLLOW"}; /* msLabelPositions[] also used in mapsymbols.c (not static) */
 static char *msBitmapFontSizes[5]={"TINY", "SMALL", "MEDIUM", "LARGE", "GIANT"};
-static char *msQueryMapStyles[4]={"NORMAL", "HILITE", "SELECTED", "INVERTED"};
+/* static char *msQueryMapStyles[4]={"NORMAL", "HILITE", "SELECTED", "INVERTED"}; */
 static char *msStatus[4]={"OFF", "ON", "DEFAULT", "EMBED"};
 /* static char *msOnOff[2]={"OFF", "ON"}; */
 static char *msTrueFalse[2]={"FALSE", "TRUE"};
@@ -444,6 +444,10 @@
   fprintf(stream, "%sEND\n", tab);
 }
 
+static void writeLineFeed(FILE *stream) {
+  fprintf(stream, "\n");
+}
+
 static void writeKeyword(FILE *stream, const char *tab, const char *name, int defaultValue, int value, int size, ...) {
   va_list argp;
   int i, j=0;
@@ -467,6 +471,11 @@
   fprintf(stream, "# value %d for %s does not map to a keyword\n", value, name);
 }
 
+static void writeDimension(FILE *stream, const char *tab, const char *name, int width, int height) {
+  if(width > 0 && height > 0)
+    fprintf(stream, "%s%s %d %d\n", tab, name, width, height);
+}
+
 static void writeExtent(FILE *stream, const char *tab, const char *name, rectObj extent) {
   if(MS_VALID_EXTENT(extent))
     fprintf(stream, "%s%s %.15g %.15g %.15g %.15g\n", tab, name, extent.minx, extent.miny, extent.maxx, extent.maxy);
@@ -4427,17 +4436,18 @@
 
 static void writeQueryMap(queryMapObj *querymap, FILE *stream)
 {
-  fprintf(stream, "  QUERYMAP\n");
+  writeBlockBegin(stream, "  ", "QUERYMAP");
 #if ALPHACOLOR_ENABLED
   if( querymap->color.alpha )
   writeColorWithAlpha(&(querymap->color), stream, "ALPHACOLOR_ENABLED", "    ");
   else
 #endif
   writeColor(&(querymap->color), stream, "COLOR", "    ");
-  fprintf(stream, "    SIZE %d %d\n", querymap->width, querymap->height);
-  fprintf(stream, "    STATUS %s\n", msStatus[querymap->status]);
-  fprintf(stream, "    STYLE %s\n", msQueryMapStyles[querymap->style]);  
-  fprintf(stream, "  END\n\n");
+  writeDimension(stream, "    ", "SIZE", querymap->width, querymap->height);
+  writeKeyword(stream, "    ", "STATUS", -1, querymap->status, 2, MS_ON, "ON", MS_OFF, "OFF");
+  writeKeyword(stream, "    ", "STYLE", -1, querymap->style, 3, MS_NORMAL, "NORMAL", MS_HILITE, "HILITE", MS_SELECTED, "SELECTED");
+  writeBlockEnd(stream, "  ", "QUERYMAP");
+  writeLineFeed(stream);
 }
 
 /*



More information about the mapserver-commits mailing list