? 1
? 1305.colorrange.patch
? 1305.split.patch
? 1305CopySupport.patch
? configopts.txt
? mapscriptvars
? newdiffs
? nohup.out
? old
? out
? patch.1305.gz
? patch.1306.gz
? patch.GD_FT.gz
? patch.svg.gz
? shp2pdf
? withfix
? mapscript/java/Makefile
Index: map.h
===================================================================
RCS file: /data2/cvsroot/mapserver/map.h,v
retrieving revision 1.403
diff -U5 -r1.403 map.h
--- map.h	15 Apr 2005 17:10:36 -0000	1.403
+++ map.h	25 Apr 2005 04:59:39 -0000
@@ -639,17 +639,17 @@
 typedef struct {
   colorObj color;
   colorObj backgroundcolor;
   colorObj outlinecolor;
 
-  /* Stuff to handle Gradient Styles */
+  /* Stuff to handle Color Range Styles */
   colorObj mincolor;
   colorObj maxcolor;
   double minvalue;
   double maxvalue;
-  char *gradientitem;
-  int gradientitemindex;
+  char *rangeitem;
+  int rangeitemindex;
   
   int symbol;
   char *symbolname;
 
   int size;
@@ -1590,12 +1590,13 @@
 MS_DLL_EXPORT int msDrawWFSLayer(mapObj *map, layerObj *layer, imageObj *image);
 
 MS_DLL_EXPORT int msDrawShape(mapObj *map, layerObj *layer, shapeObj *shape, imageObj *image, int style);
 MS_DLL_EXPORT int msDrawPoint(mapObj *map, layerObj *layer, pointObj *point, imageObj *image, int classindex, char *labeltext);
 
-  /*Gradient Support*/
-MS_DLL_EXPORT int msMapGradient(styleObj *style, shapeObj *shape);
+  /*Range Support*/
+MS_DLL_EXPORT int msShapeToRange(styleObj *style, shapeObj *shape);
+MS_DLL_EXPORT int msValueToRange(styleObj *style, double fieldVal);
 
 MS_DLL_EXPORT void msCircleDrawLineSymbol(symbolSetObj *symbolset, imageObj *image, pointObj *p, double r, styleObj *style, double scalefactor);
 MS_DLL_EXPORT void msCircleDrawShadeSymbol(symbolSetObj *symbolset, imageObj *image, pointObj *p, double r, styleObj *style, double scalefactor);
 MS_DLL_EXPORT void msDrawMarkerSymbol(symbolSetObj *symbolset,imageObj *image, pointObj *p, styleObj *style, double scalefactor);
 MS_DLL_EXPORT void msDrawLineSymbol(symbolSetObj *symbolset, imageObj *image, shapeObj *p, styleObj *style, double scalefactor);
Index: mapcopy.c
===================================================================
RCS file: /data2/cvsroot/mapserver/mapcopy.c,v
retrieving revision 1.38
diff -U5 -r1.38 mapcopy.c
--- mapcopy.c	15 Apr 2005 18:44:31 -0000	1.38
+++ mapcopy.c	25 Apr 2005 04:59:39 -0000
@@ -393,15 +393,15 @@
     MS_COPYSTELEM(minvalue);
     MS_COPYSTELEM(maxvalue);
 
     if (src->angleitem) MS_COPYSTRING(dst->angleitem, src->angleitem);
     if (src->sizeitem) MS_COPYSTRING(dst->sizeitem, src->sizeitem);
-    if (src->gradientitem) MS_COPYSTRING(dst->gradientitem, src->gradientitem);
+    if (src->rangeitem) MS_COPYSTRING(dst->rangeitem, src->rangeitem);
 
     MS_COPYSTELEM(angleitemindex);
     MS_COPYSTELEM(sizeitemindex);
-    MS_COPYSTELEM(gradientitemindex);
+    MS_COPYSTELEM(rangeitemindex);
 
     return MS_SUCCESS;
 }
 
 /***********************************************************************
Index: mapdraw.c
===================================================================
RCS file: /data2/cvsroot/mapserver/mapdraw.c,v
retrieving revision 1.89
diff -U5 -r1.89 mapdraw.c
--- mapdraw.c	15 Apr 2005 17:10:36 -0000	1.89
+++ mapdraw.c	25 Apr 2005 04:59:39 -0000
@@ -1295,17 +1295,17 @@
 
   msDrawStartShape(map, layer, image, shape);
 
   c = shape->classindex;
 
-/* Before we do anything else, we will check for a gradientitem.
+/* Before we do anything else, we will check for a rangeitem.
    If its there, we need to change the style's color to map
-   the gradient to the shape */
+   the range to the shape */
   for(s=0; s<layer->class[c].numstyles; s++)
     {
-      if (layer->class[c].styles[s].gradientitem !=  NULL)
-	msMapGradient(&(layer->class[c].styles[s]), shape);
+      if (layer->class[c].styles[s].rangeitem !=  NULL)
+	msShapeToRange(&(layer->class[c].styles[s]), shape);
     }
   
   /* changed when Tomas added CARTOLINE symbols */
   if(layer->class[c].styles[0].size == -1)
       csz = MS_NINT(((msSymbolGetDefaultSize(&(map->symbolset.symbol[layer->class[c].styles[0].symbol]))) * layer->scalefactor) / 2.0);
@@ -1950,44 +1950,54 @@
                     shapeObj *shape)
 {
 }
 /**
  * take the value from the shape and use it to change the 
- * color in the style to match the gradient map
+ * color in the style to match the range map
  */
-int msMapGradient(styleObj *style, shapeObj *shape)
+int msShapeToRange(styleObj *style, shapeObj *shape)
 {
   double fieldVal;
-  double range;
-  double scaledVal;
   char* fieldStr;
 
-  /*first, get the value of the gradientitem, which should*/
+  /*first, get the value of the rangeitem, which should*/
   /*evaluate to a double*/
-  fieldStr = shape->values[style->gradientitemindex];
+  fieldStr = shape->values[style->rangeitemindex];
   if (fieldStr == NULL) /*if there's not value, bail*/
     {
       return MS_FAILURE;
     }
   fieldVal = 0.0;
-
   fieldVal = atof(fieldStr); /*faith that it's ok -- */
   /*should switch to strtod*/
+  return msValueToRange(style, fieldVal);
+}
+
+/**
+ * Allow direct mapping of a value so that mapscript can use the 
+ * Ranges.  The styls passed in is updated to reflect the right color 
+ * based on the fieldVal
+ */
+int msValueToRange(styleObj *style, double fieldVal)
+{
+  double range;
+  double scaledVal;
+
   range = style->maxvalue - style->minvalue;
   scaledVal = (fieldVal - style->minvalue)/range;
   
-  /*At this point, we know where on the gradient we need to be*/
+  /*At this point, we know where on the range we need to be*/
   /*However, we don't know how to map it yet, since RGB(A) can */
   /*Go up or down*/
   style->color.red = (int)(MAX(0,(MIN(255, (style->mincolor.red + ((style->maxcolor.red - style->mincolor.red) * scaledVal))))));
   style->color.green = (int)(MAX(0,(MIN(255,(style->mincolor.green + ((style->maxcolor.green - style->mincolor.green) * scaledVal))))));
   style->color.blue = (int)(MAX(0,(MIN(255,(style->mincolor.blue + ((style->maxcolor.blue - style->mincolor.blue) * scaledVal))))));
   style->color.pen = MS_PEN_UNSET; /*so it will recalculate pen*/
 
-  /*( "msMapGradient(): %i %i %i", style->color.red , style->color.green, style->color.blue);*/
+  /*( "msMapRange(): %i %i %i", style->color.red , style->color.green, style->color.blue);*/
 
 #if ALPHACOLOR_ENABLED
-  /*NO ALPHA GRADIENT YET  style->color.alpha = style->mincolor.alpha + ((style->maxcolor.alpha - style->mincolor.alpha) * scaledVal);*/
+  /*NO ALPHA RANGE YET  style->color.alpha = style->mincolor.alpha + ((style->maxcolor.alpha - style->mincolor.alpha) * scaledVal);*/
 #endif
 
   return MS_SUCCESS;
 }
Index: mapfile.c
===================================================================
RCS file: /data2/cvsroot/mapserver/mapfile.c,v
retrieving revision 1.299
diff -U5 -r1.299 mapfile.c
--- mapfile.c	15 Apr 2005 19:32:33 -0000	1.299
+++ mapfile.c	25 Apr 2005 04:59:40 -0000
@@ -423,10 +423,16 @@
 static void writeColor(colorObj *color, FILE *stream, char *name, char *tab) {
   if(MS_VALID_COLOR(*color))
     fprintf(stream, "  %s%s %d %d %d\n", tab, name, color->red, color->green, color->blue);
 }
 
+static void writeColorRange(colorObj *mincolor,colorObj *maxcolor, FILE *stream, char *name, char *tab) {
+  if(MS_VALID_COLOR(*mincolor) && MS_VALID_COLOR(*maxcolor))
+    fprintf(stream, "  %s%s %d %d %d  %d %d %d\n", tab, name, mincolor->red, mincolor->green, mincolor->blue,
+	    maxcolor->red, maxcolor->green, maxcolor->blue);
+}
+
 #if ALPHACOLOR_ENABLED
 static void writeColorWithAlpha(colorObj *color, FILE *stream, char *name, char *tab) {
   if(MS_VALID_COLOR(*color))
     fprintf(stream, "  %s%s %d %d %d %d\n", tab, name, color->red, color->green, color->blue, color->alpha);
 }
@@ -1609,17 +1615,17 @@
 */
 int initStyle(styleObj *style) {
   MS_INIT_COLOR(style->color, -1,-1,-1); /* must explictly set colors */
   MS_INIT_COLOR(style->backgroundcolor, -1,-1,-1);
   MS_INIT_COLOR(style->outlinecolor, -1,-1,-1);
-  /* New Gradient fields*/
+  /* New Color Range fields*/
   MS_INIT_COLOR(style->mincolor, -1,-1,-1);
   MS_INIT_COLOR(style->maxcolor, -1,-1,-1);
   style->minvalue = 0.0;
   style->maxvalue = 1.0;
-  style->gradientitem = NULL;
-  /* End Gradient fields*/
+  style->rangeitem = NULL;
+  /* End Color Range fields*/
   style->symbol = 0; /* there is always a default symbol*/
   style->symbolname = NULL;
   style->size = -1; /* in SIZEUNITS (layerObj) */
   style->minsize = MS_MINSYMBOLSIZE;
   style->maxsize = MS_MAXSYMBOLSIZE;
@@ -1640,27 +1646,25 @@
 int loadStyle(styleObj *style) {
   int state;
 
   for(;;) {
     switch(msyylex()) {
-  /* New Gradient fields*/
-    case (MINCOLOR):
+  /* New Color Range fields*/
+    case (COLORRANGE):
+      /*These are both in one line now*/
       if(loadColor(&(style->mincolor)) != MS_SUCCESS) return(MS_FAILURE);
-      break;
-    case (MAXCOLOR):
       if(loadColor(&(style->maxcolor)) != MS_SUCCESS) return(MS_FAILURE);
       break;
-    case(MINVALUE):
+    case(DATARANGE):
+      /*These are both in one line now*/
       if(getDouble(&(style->minvalue)) == -1) return(-1);
-      break;
-    case(MAXVALUE):
       if(getDouble(&(style->maxvalue)) == -1) return(-1);
       break;
-    case(GRADIENTITEM):
-      if(getString(&style->gradientitem) == MS_FAILURE) return(-1);
+    case(RANGEITEM):
+      if(getString(&style->rangeitem) == MS_FAILURE) return(-1);
       break;
-  /* End Gradient fields*/
+  /* End Range fields*/
     case(ANGLE):
       if(getDouble(&(style->angle)) == -1) return(MS_FAILURE);
       break;
     case(ANGLEITEM):
       if(getString(&style->angleitem) == MS_FAILURE) return(MS_FAILURE);
@@ -1677,14 +1681,13 @@
       break;
 #if ALPHACOLOR_ENABLED
     case(ALPHACOLOR):
       if(loadColorWithAlpha(&(style->color)) != MS_SUCCESS) return(MS_FAILURE);
       break;
-    case (ALPHAMINCOLOR):
+    case (ALPHACOLORRANGE):
+      /*These will load together*/
       if(loadColorWithAlpha(&(style->mincolor)) != MS_SUCCESS) return(MS_FAILURE);
-      break;
-    case (ALPHAMAXCOLOR):
       if(loadColorWithAlpha(&(style->maxcolor)) != MS_SUCCESS) return(MS_FAILURE);
       break;
 #endif
     case(EOF):
       msSetError(MS_EOFERR, NULL, "loadStyle()");
@@ -1745,11 +1748,11 @@
 
 void freeStyle(styleObj *style) {
   msFree(style->symbolname);
   msFree(style->angleitem);
   msFree(style->sizeitem);
-  msFree(style->gradientitem);
+  msFree(style->rangeitem);
 }
 
 void writeStyle(styleObj *style, FILE *stream) {
   fprintf(stream, "      STYLE\n");
   if(style->angle != 0) fprintf(stream, "        ANGLE %g\n", style->angle);
@@ -1775,16 +1778,14 @@
   else
     fprintf(stream, "        SYMBOL %d\n", style->symbol);
   if(style->width > 1) fprintf(stream, "        SIZE %d\n", style->width);
   if (style->offsetx != 0 || style->offsety != 0)  fprintf(stream, "        OFFSET %d %d\n", style->offsetx, style->offsety);
 
-  if(style->gradientitem) {
-    fprintf(stream, "        GRADIENTITEM %s\n", style->gradientitem);
-    writeColor(&(style->maxcolor), stream, "MAXCOLOR", "        ");
-    writeColor(&(style->mincolor), stream, "MINCOLOR", "        ");
-    fprintf(stream, "        MAXVALUE %g\n", style->maxvalue);
-    fprintf(stream, "        MINVALUE %g\n", style->minvalue);
+  if(style->rangeitem) {
+    fprintf(stream, "        RANGEITEM %s\n", style->rangeitem);
+    writeColorRange(&(style->mincolor),&(style->maxcolor), stream, "COLORRANGE", "        ");
+    fprintf(stream, "        DATARANGE %g %g\n", style->minvalue, style->maxvalue);
   }
 
   fprintf(stream, "      END\n");
 }
 
Index: mapfile.h
===================================================================
RCS file: /data2/cvsroot/mapserver/mapfile.h,v
retrieving revision 1.46
diff -U5 -r1.46 mapfile.h
--- mapfile.h	15 Apr 2005 17:10:36 -0000	1.46
+++ mapfile.h	25 Apr 2005 04:59:40 -0000
@@ -206,15 +206,12 @@
 
 #define WIDTH 1163
 #define MINWIDTH 1164
 #define MAXWIDTH 1165
 
- /* Gradient support */
-#define MINCOLOR 1170
-#define MAXCOLOR 1171
-#define ALPHAMINCOLOR 1172
-#define ALPHAMAXCOLOR 1173
-#define MINVALUE 1174
-#define MAXVALUE 1175
-#define GRADIENTITEM 1176
+ /* Color Range support (was Gradient Support)*/
+#define COLORRANGE 1170
+#define ALPHACOLORRANGE 1171
+#define DATARANGE 1172
+#define RANGEITEM 1173
 
 #endif /* MAPFILE_H */
Index: mapgml.c
===================================================================
RCS file: /data2/cvsroot/mapserver/mapgml.c,v
retrieving revision 1.56
diff -U5 -r1.56 mapgml.c
--- mapgml.c	21 Apr 2005 21:10:38 -0000	1.56
+++ mapgml.c	25 Apr 2005 04:59:40 -0000
@@ -1089,11 +1089,11 @@
             msIO_fprintf(stream, "<!-- WARNING: The value '%s' is not valid in a XML tag context. -->\n", layer_name);
         msIO_fprintf(stream, "      <%s>\n", layer_name);
 
 
 	/* write the bounding box */
-	if(msOWSGetEPSGProj(&(map->projection), &(map->web.metadata), "FGO", MS_TRUE)) // use the map projection first
+	if(msOWSGetEPSGProj(&(map->projection), &(map->web.metadata), "FGO", MS_TRUE)) /* use the map projection first*/
 
 #ifdef USE_PROJ
 	  gmlWriteBounds(stream, outputformat, &(shape.bounds), msOWSGetEPSGProj(&(map->projection), &(map->web.metadata), "FGO", MS_TRUE), "        ");
 	else /* then use the layer projection and/or metadata */
 	  gmlWriteBounds(stream, outputformat, &(shape.bounds), msOWSGetEPSGProj(&(lp->projection), &(lp->metadata), "FGO", MS_TRUE), "        ");
Index: maplayer.c
===================================================================
RCS file: /data2/cvsroot/mapserver/maplayer.c,v
retrieving revision 1.103
diff -U5 -r1.103 maplayer.c
--- maplayer.c	15 Apr 2005 17:10:36 -0000	1.103
+++ maplayer.c	25 Apr 2005 04:59:40 -0000
@@ -871,11 +871,11 @@
 
     for(i=0; i<layer->numclasses; i++) {
       for(j=0; j<layer->class[i].numstyles; j++) {
         if(layer->class[i].styles[j].angleitem) nt++;
 	if(layer->class[i].styles[j].sizeitem) nt++;
-	if(layer->class[i].styles[j].gradientitem) nt++;
+	if(layer->class[i].styles[j].rangeitem) nt++;
       }
     }
 
     ne = 0;
     if(layer->filter.type == MS_EXPRESSION) {
@@ -972,11 +972,11 @@
 
       for(i=0; i<layer->numclasses; i++) {
 	for(j=0; j<layer->class[i].numstyles; j++) {
 	  if(layer->class[i].styles[j].angleitem) layer->class[i].styles[j].angleitemindex = string2list(layer->items, &(layer->numitems), layer->class[i].styles[j].angleitem);
 	  if(layer->class[i].styles[j].sizeitem) layer->class[i].styles[j].sizeitemindex = string2list(layer->items, &(layer->numitems), layer->class[i].styles[j].sizeitem); 
-	  if(layer->class[i].styles[j].gradientitem) layer->class[i].styles[j].gradientitemindex = string2list(layer->items, &(layer->numitems), layer->class[i].styles[j].gradientitem); 
+	  if(layer->class[i].styles[j].rangeitem) layer->class[i].styles[j].rangeitemindex = string2list(layer->items, &(layer->numitems), layer->class[i].styles[j].rangeitem); 
 	}
       }
 
       if(layer->filter.type == MS_EXPRESSION) expression2list(layer->items, &(layer->numitems), &(layer->filter));      
     }
Index: maplexer.l
===================================================================
RCS file: /data2/cvsroot/mapserver/maplexer.l,v
retrieving revision 1.90
diff -U5 -r1.90 maplexer.l
--- maplexer.l	15 Apr 2005 17:10:36 -0000	1.90
+++ maplexer.l	25 Apr 2005 04:59:41 -0000
@@ -118,17 +118,15 @@
 <EXPRESSION_STRING>in                          { return(IN); }
 <EXPRESSION_STRING>not|!                       { return(NOT); }
 
 <EXPRESSION_STRING>length                      { return(LENGTH); }
 
-<INITIAL,OBJECT_STRING>mincolor 	       { return(MINCOLOR); }
-<INITIAL,OBJECT_STRING>maxcolor 	       { return(MAXCOLOR); }
-<INITIAL,OBJECT_STRING>alphamincolor	       { return(ALPHAMAXCOLOR); }
-<INITIAL,OBJECT_STRING>alphamaxcolor 	       { return(ALPHAMAXCOLOR); }
-<INITIAL,OBJECT_STRING>minvalue                { return(MINVALUE); }
-<INITIAL,OBJECT_STRING>maxvalue                { return(MAXVALUE); }
-<INITIAL,OBJECT_STRING>gradientitem            { return(GRADIENTITEM); }
+
+<INITIAL,OBJECT_STRING>colorrange              { return(COLORRANGE); }
+<INITIAL,OBJECT_STRING>alphacolorrange	       { return(ALPHACOLORRANGE); }
+<INITIAL,OBJECT_STRING>datarange               { return(DATARANGE); }
+<INITIAL,OBJECT_STRING>rangeitem               { return(RANGEITEM); }
 
 <INITIAL,OBJECT_STRING>alphacolor		       { return(ALPHACOLOR); }
 <INITIAL,OBJECT_STRING>angle                   { return(ANGLE); }
 <INITIAL,OBJECT_STRING>angleitem               { return(ANGLEITEM); }
 <INITIAL,OBJECT_STRING>antialias               { return(ANTIALIAS); }
@@ -368,11 +366,11 @@
 <EXPRESSION_STRING>\`[^\`]*\`                  {
                                                  msyytext++;
 			                         msyytext[strlen(msyytext)-1] = '\0';
                                                  msTimeInit(&msyylval.tmval);
                                                  msParseTime(msyytext, &msyylval.tmval);
-                                                 // TODO: need to trap bad date formats somehow, should return a parse error (need an error token in mapparser.y)
+                                                 /* TODO: need to trap bad date formats somehow, should return a parse error (need an error token in mapparser.y)*/
                                                  return(TIME);
                                                }
 
 <INITIAL,VALUE_STRING>\/[^\/]*\/               {
                                                  msyytext++;
Index: mapogcfilter.h
===================================================================
RCS file: /data2/cvsroot/mapserver/mapogcfilter.h,v
retrieving revision 1.9
diff -U5 -r1.9 mapogcfilter.h
--- mapogcfilter.h	29 Mar 2005 22:53:14 -0000	1.9
+++ mapogcfilter.h	25 Apr 2005 04:59:41 -0000
@@ -161,11 +161,11 @@
 char *FLTGetIsBetweenComparisonExpresssion(FilterEncodingNode *psFilterNode);
 char *FLTGetIsLikeComparisonExpression(FilterEncodingNode *psFilterNode);
 int FLTHasSpatialFilter(FilterEncodingNode *psFilterNode);
 
 
-//SQL expressions related functions.
+/*SQL expressions related functions.*/
 void FLTApplySimpleSQLFilter(FilterEncodingNode *psNode, mapObj *map, 
                           int iLayerIndex);
 
 char *FLTGetSQLExpression(FilterEncodingNode *psFilterNode,int connectiontype);
 char *FLTGetBinaryComparisonSQLExpresssion(FilterEncodingNode *psFilterNode);

