[mapserver-commits] r12638 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Fri Oct 7 11:07:07 EDT 2011


Author: aboudreault
Date: 2011-10-07 08:07:07 -0700 (Fri, 07 Oct 2011)
New Revision: 12638

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapfile.c
Log:
Python Mapscript does not write COLOR to reference map (#4042)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2011-10-07 10:46:38 UTC (rev 12637)
+++ trunk/mapserver/HISTORY.TXT	2011-10-07 15:07:07 UTC (rev 12638)
@@ -15,7 +15,10 @@
 Current Version (SVN trunk, 6.1-dev, future 6.2): 
 -------------------------------------------------
 
+- Fixed Python Mapscript does not write COLOR to reference map (#4042)
+
 - Added XMP support for metadata embedding, RFC 76, (#3932)
+
 - Added GetLegendGraphic Cascading support (#3923)
 
 - Rewrite  postgres TIME queries to take advantage of indexes (#3374)

Modified: trunk/mapserver/mapfile.c
===================================================================
--- trunk/mapserver/mapfile.c	2011-10-07 10:46:38 UTC (rev 12637)
+++ trunk/mapserver/mapfile.c	2011-10-07 15:07:07 UTC (rev 12638)
@@ -616,8 +616,8 @@
   fprintf(stream, "%s [%s]\n", name, binding->item);
 }
 
+/* Force the color writing. Used when -1 -1 -1 is not the default color */
 static void writeColor(FILE *stream, int indent, const char *name, colorObj *color) {
-  if(!MS_VALID_COLOR(*color)) return;
   writeIndent(stream, ++indent);
 #if ALPHACOLOR_ENABLED
   fprintf(stream, "%s %d %d %d\n", name, color->red, color->green, color->blue, color->alpha);
@@ -626,6 +626,11 @@
 #endif
 }
 
+static void writeColorDefault(FILE *stream, int indent, const char *name, colorObj *color) {
+  if(!MS_VALID_COLOR(*color)) return;
+  writeColor(stream, indent, name, color);
+}
+
 /* todo: deal with alpha's... */
 static void writeColorRange(FILE *stream, int indent, const char *name, colorObj *mincolor, colorObj *maxcolor) {
   if(!MS_VALID_COLOR(*mincolor) || !MS_VALID_COLOR(*maxcolor)) return;
@@ -1972,7 +1977,7 @@
     
   if(label->numbindings > 0 && label->bindings[MS_LABEL_BINDING_OUTLINECOLOR].item)
     writeAttributeBinding(stream, indent, "OUTLINECOLOR", &(label->bindings[MS_LABEL_BINDING_OUTLINECOLOR]));
-  else writeColor(stream, indent, "OUTLINECOLOR", &(label->outlinecolor));
+  else writeColorDefault(stream, indent, "OUTLINECOLOR", &(label->outlinecolor));
 
   writeNumber(stream, indent, "OUTLINEWIDTH", 1, label->outlinewidth);
   writeKeyword(stream, indent, "PARTIALS", label->partials, 1, MS_FALSE, "FALSE");
@@ -1986,7 +1991,7 @@
   else writeNumber(stream, indent, "PRIORITY", MS_DEFAULT_LABEL_PRIORITY, label->priority);
 
   writeNumber(stream, indent, "REPEATDISTANCE", 0, label->repeatdistance);
-  writeColor(stream, indent, "SHADOWCOLOR", &(label->shadowcolor));
+  writeColorDefault(stream, indent, "SHADOWCOLOR", &(label->shadowcolor));
   writeDimension(stream, indent, "SHADOWSIZE", label->shadowsizex, label->shadowsizey, label->bindings[MS_LABEL_BINDING_SHADOWSIZEX].item, label->bindings[MS_LABEL_BINDING_SHADOWSIZEY].item);
 
   writeNumber(stream, indent, "MAXOVERLAPANGLE", 22.5, label->maxoverlapangle);
@@ -2694,11 +2699,11 @@
   else writeNumberOrKeyword(stream, indent, "ANGLE", 360, style->angle, style->autoangle, 1, MS_TRUE, "AUTO");
 
   writeKeyword(stream, indent, "ANTIALIAS", style->antialias, 1, MS_TRUE, "TRUE");
-  writeColor(stream, indent, "BACKGROUNDCOLOR", &(style->backgroundcolor));
+  writeColorDefault(stream, indent, "BACKGROUNDCOLOR", &(style->backgroundcolor));
 
   if(style->numbindings > 0 && style->bindings[MS_STYLE_BINDING_COLOR].item)
     writeAttributeBinding(stream, indent, "COLOR", &(style->bindings[MS_STYLE_BINDING_COLOR]));
-  else writeColor(stream, indent, "COLOR", &(style->color));
+  else writeColorDefault(stream, indent, "COLOR", &(style->color));
   
   writeNumber(stream, indent, "GAP", 0, style->gap);
 
@@ -2745,7 +2750,7 @@
 
   if(style->numbindings > 0 && style->bindings[MS_STYLE_BINDING_OUTLINECOLOR].item)
     writeAttributeBinding(stream, indent, "OUTLINECOLOR", &(style->bindings[MS_STYLE_BINDING_OUTLINECOLOR]));
-  else writeColor(stream, indent, "OUTLINECOLOR", &(style->outlinecolor)); 
+  else writeColorDefault(stream, indent, "OUTLINECOLOR", &(style->outlinecolor)); 
 
   if(style->numbindings > 0 && style->bindings[MS_STYLE_BINDING_OUTLINEWIDTH].item)
     writeAttributeBinding(stream, indent, "OUTLINEWIDTH", &(style->bindings[MS_STYLE_BINDING_OUTLINEWIDTH]));
@@ -4007,7 +4012,7 @@
   writeNumber(stream, indent, "MINSCALEDENOM", -1, layer->minscaledenom);
   writeNumber(stream, indent, "MINFEATURESIZE", -1, layer->minfeaturesize);
   writeString(stream, indent, "NAME", NULL, layer->name);
-  writeColor(stream, indent, "OFFSITE", &(layer->offsite));
+  writeColorDefault(stream, indent, "OFFSITE", &(layer->offsite));
   writeString(stream, indent, "PLUGIN", NULL, layer->plugin_library_original);
   writeKeyword(stream, indent, "POSTLABELCACHE", layer->postlabelcache, 1, MS_TRUE, "TRUE");
   for(i=0; i<layer->numprocessing; i++)
@@ -4523,7 +4528,7 @@
   writeDimension(stream, indent, "KEYSIZE", legend->keysizex, legend->keysizey, NULL, NULL);
   writeDimension(stream, indent, "KEYSPACING", legend->keyspacingx, legend->keyspacingy, NULL, NULL);
   writeLabel(stream, indent, &(legend->label));
-  writeColor(stream, indent, "OUTLINECOLOR", &(legend->outlinecolor));
+  writeColorDefault(stream, indent, "OUTLINECOLOR", &(legend->outlinecolor));
   if(legend->status == MS_EMBED) writeKeyword(stream, indent, "POSITION", legend->position, 6, MS_LL, "LL", MS_UL, "UL", MS_UR, "UR", MS_LR, "LR", MS_UC, "UC", MS_LC, "LC");
   writeKeyword(stream, indent, "POSTLABELCACHE", legend->postlabelcache, 1, MS_TRUE, "TRUE");
   writeKeyword(stream, indent, "STATUS", legend->status, 3, MS_ON, "ON", MS_OFF, "OFF", MS_EMBED, "EMBED");
@@ -4662,13 +4667,13 @@
   indent++;
   writeBlockBegin(stream, indent, "SCALEBAR");
   writeKeyword(stream, indent, "ALIGN", scalebar->align, 2, MS_ALIGN_LEFT, "LEFT", MS_ALIGN_RIGHT, "RIGHT");
-  writeColor(stream, indent, "BACKGROUNDCOLOR", &(scalebar->backgroundcolor));
+  writeColorDefault(stream, indent, "BACKGROUNDCOLOR", &(scalebar->backgroundcolor));
   writeColor(stream, indent, "COLOR", &(scalebar->color));
-  writeColor(stream, indent, "IMAGECOLOR", &(scalebar->imagecolor));
+  writeColorDefault(stream, indent, "IMAGECOLOR", &(scalebar->imagecolor));
   writeKeyword(stream, indent, "INTERLACE", scalebar->interlace, 2, MS_TRUE, "TRUE", MS_FALSE, "FALSE");
   writeNumber(stream, indent, "INTERVALS", -1, scalebar->intervals);
   writeLabel(stream, indent, &(scalebar->label));
-  writeColor(stream, indent, "OUTLINECOLOR", &(scalebar->outlinecolor));
+  writeColorDefault(stream, indent, "OUTLINECOLOR", &(scalebar->outlinecolor));
   if(scalebar->status == MS_EMBED) writeKeyword(stream, indent, "POSITION", scalebar->position, 6, MS_LL, "LL", MS_UL, "UL", MS_UR, "UR", MS_LR, "LR", MS_UC, "UC", MS_LC, "LC");
   writeKeyword(stream, indent, "POSTLABELCACHE", scalebar->postlabelcache, 1, MS_TRUE, "TRUE");
   writeDimension(stream, indent, "SIZE", scalebar->width, scalebar->height, NULL, NULL);



More information about the mapserver-commits mailing list