[mapserver-commits] r7926 - in branches/branch-5-2/mapserver: . mapscript/php3 mapscript/swiginc

svn at osgeo.org svn at osgeo.org
Thu Sep 25 15:30:26 EDT 2008


Author: aboudreault
Date: 2008-09-25 15:30:26 -0400 (Thu, 25 Sep 2008)
New Revision: 7926

Modified:
   branches/branch-5-2/mapserver/HISTORY.TXT
   branches/branch-5-2/mapserver/mapchart.c
   branches/branch-5-2/mapserver/mapdraw.c
   branches/branch-5-2/mapserver/mapscript/php3/mapscript_i.c
   branches/branch-5-2/mapserver/mapscript/swiginc/rect.i
   branches/branch-5-2/mapserver/mapscript/swiginc/shape.i
   branches/branch-5-2/mapserver/mapserver.h
   branches/branch-5-2/mapserver/maputil.c
Log:
Fix bug in 5.2 when QUERYMAP hilite color is set and the shape's color in a
layer is from a data source


Modified: branches/branch-5-2/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-5-2/mapserver/HISTORY.TXT	2008-09-23 21:20:08 UTC (rev 7925)
+++ branches/branch-5-2/mapserver/HISTORY.TXT	2008-09-25 19:30:26 UTC (rev 7926)
@@ -13,6 +13,9 @@
 Current Version (SVN branch-5-2)
 --------------------------------
 
+- Fixed bug when QUERYMAP hilite color is set and the shape's color in a 
+  layer is from a data source (#2769)
+
 - PHP paste image should also work with AGG (#2682)
 
 - Correct allocation error in mapmssql2008.c (#2768)

Modified: branches/branch-5-2/mapserver/mapchart.c
===================================================================
--- branches/branch-5-2/mapserver/mapchart.c	2008-09-23 21:20:08 UTC (rev 7925)
+++ branches/branch-5-2/mapserver/mapchart.c	2008-09-25 19:30:26 UTC (rev 7926)
@@ -165,7 +165,7 @@
     bottom=center.y+height/2.;
     left=center.x-width/2.;
 
-    if(msBindLayerToShape(layer, shape) != MS_SUCCESS)
+    if(msBindLayerToShape(layer, shape, MS_FALSE) != MS_SUCCESS)
         return MS_FAILURE; /* error message is set in msBindLayerToShape() */
 
     values=(float*)calloc(layer->numclasses,sizeof(float));
@@ -273,7 +273,7 @@
         layer->project = MS_FALSE;
 #endif
 
-    if(msBindLayerToShape(layer, shape) != MS_SUCCESS)
+    if(msBindLayerToShape(layer, shape, MS_FALSE) != MS_SUCCESS)
         return MS_FAILURE; /* error message is set in msBindLayerToShape() */
     
     /*check if dynamic diameter was wanted*/

Modified: branches/branch-5-2/mapserver/mapdraw.c
===================================================================
--- branches/branch-5-2/mapserver/mapdraw.c	2008-09-23 21:20:08 UTC (rev 7925)
+++ branches/branch-5-2/mapserver/mapdraw.c	2008-09-25 19:30:26 UTC (rev 7926)
@@ -904,9 +904,9 @@
       shape.text = msShapeGetAnnotation(layer, &shape);
 
     if(cache)
-      status = msDrawShape(map, layer, &shape, image, 0); /* draw only the first style */
+      status = msDrawShape(map, layer, &shape, image, 0, MS_FALSE); /* draw only the first style */
     else
-      status = msDrawShape(map, layer, &shape, image, -1); /* all styles  */
+      status = msDrawShape(map, layer, &shape, image, -1, MS_FALSE); /* all styles  */
     if(status != MS_SUCCESS) {
       msFreeShape(&shape);
       retcode = MS_FAILURE;
@@ -1095,9 +1095,9 @@
       shape.text = msShapeGetAnnotation(layer, &shape);
 
     if(cache)
-      status = msDrawShape(map, layer, &shape, image, 0); /* draw only the first style */
+      status = msDrawShape(map, layer, &shape, image, 0, MS_TRUE); /* draw only the first style */
     else
-      status = msDrawShape(map, layer, &shape, image, -1); /* all styles  */
+       status = msDrawShape(map, layer, &shape, image, -1, MS_TRUE); /* all styles  */
     if(status != MS_SUCCESS) {
       msLayerClose(layer);
       msFree(colorbuffer);
@@ -1270,9 +1270,10 @@
 /*
 ** Function to render an individual shape, the style variable enables/disables the drawing of a single style
 ** versus a single style. This is necessary when drawing entire layers as proper overlay can only be achived
-** through caching. 
+** through caching. "querymapMode" parameter is used to tell msBindLayerToShape to not override the  
+** QUERYMAP HILITE color. 
 */
-int msDrawShape(mapObj *map, layerObj *layer, shapeObj *shape, imageObj *image, int style)
+int msDrawShape(mapObj *map, layerObj *layer, shapeObj *shape, imageObj *image, int style,  int querymapMode)
 {
   int i,j,c,s;
   rectObj cliprect;
@@ -1332,7 +1333,7 @@
   cliprect.maxx = map->extent.maxx + csz*map->cellsize;
   cliprect.maxy = map->extent.maxy + csz*map->cellsize;
 
-  if(msBindLayerToShape(layer, shape) != MS_SUCCESS)
+  if(msBindLayerToShape(layer, shape, querymapMode) != MS_SUCCESS)
     return MS_FAILURE; /* error message is set in msBindLayerToShape() */
   
   if(shape->text && (layer->class[c]->label.encoding || layer->class[c]->label.wrap)) {

Modified: branches/branch-5-2/mapserver/mapscript/php3/mapscript_i.c
===================================================================
--- branches/branch-5-2/mapserver/mapscript/php3/mapscript_i.c	2008-09-23 21:20:08 UTC (rev 7925)
+++ branches/branch-5-2/mapserver/mapscript/php3/mapscript_i.c	2008-09-25 19:30:26 UTC (rev 7926)
@@ -806,7 +806,7 @@
 
 int shapeObj_draw(shapeObj *self, mapObj *map, layerObj *layer, 
                   imageObj *img) {
-    return msDrawShape(map, layer, self, img, -1);
+    return msDrawShape(map, layer, self, img, -1, MS_FALSE);
   }
 
 void shapeObj_setBounds(shapeObj *self) {
@@ -1020,7 +1020,7 @@
     shape.classindex = classindex;
     shape.text = strdup(text);
 
-    msDrawShape(map, layer, &shape, img, -1);
+    msDrawShape(map, layer, &shape, img, -1, MS_FALSE);
 
     msFreeShape(&shape);
     

Modified: branches/branch-5-2/mapserver/mapscript/swiginc/rect.i
===================================================================
--- branches/branch-5-2/mapserver/mapscript/swiginc/rect.i	2008-09-23 21:20:08 UTC (rev 7925)
+++ branches/branch-5-2/mapserver/mapscript/swiginc/rect.i	2008-09-25 19:30:26 UTC (rev 7926)
@@ -92,7 +92,7 @@
         shape.classindex = classindex;
         shape.text = strdup(text);
 
-        msDrawShape(map, layer, &shape, image, -1);
+        msDrawShape(map, layer, &shape, image, -1, MS_FALSE);
 
         msFreeShape(&shape);
     

Modified: branches/branch-5-2/mapserver/mapscript/swiginc/shape.i
===================================================================
--- branches/branch-5-2/mapserver/mapscript/swiginc/shape.i	2008-09-23 21:20:08 UTC (rev 7925)
+++ branches/branch-5-2/mapserver/mapscript/swiginc/shape.i	2008-09-25 19:30:26 UTC (rev 7926)
@@ -82,7 +82,7 @@
     }
 
     int draw(mapObj *map, layerObj *layer, imageObj *image) {
-        return msDrawShape(map, layer, self, image, -1);
+        return msDrawShape(map, layer, self, image, -1, MS_FALSE);
     }
 
     void setBounds() 

Modified: branches/branch-5-2/mapserver/mapserver.h
===================================================================
--- branches/branch-5-2/mapserver/mapserver.h	2008-09-23 21:20:08 UTC (rev 7925)
+++ branches/branch-5-2/mapserver/mapserver.h	2008-09-25 19:30:26 UTC (rev 7926)
@@ -1825,7 +1825,7 @@
 MS_DLL_EXPORT int msDrawWMSLayer(mapObj *map, layerObj *layer, imageObj *image);
 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 msDrawShape(mapObj *map, layerObj *layer, shapeObj *shape, imageObj *image, int style, int querymapMode);
 MS_DLL_EXPORT int msDrawPoint(mapObj *map, layerObj *layer, pointObj *point, imageObj *image, int classindex, char *labeltext);
 
   /*Range Support*/
@@ -1978,7 +1978,7 @@
 /* ==================================================================== */
 /* For mappdf */
 MS_DLL_EXPORT int getRgbColor(mapObj *map,int i,int *r,int *g,int *b); /* maputil.c */
-MS_DLL_EXPORT int msBindLayerToShape(layerObj *layer, shapeObj *shape);
+MS_DLL_EXPORT int msBindLayerToShape(layerObj *layer, shapeObj *shape, int querymapMode);
 MS_DLL_EXPORT int msValidateContexts(mapObj *map);
 MS_DLL_EXPORT int msEvalContext(mapObj *map, layerObj *layer, char *context);
 MS_DLL_EXPORT int msEvalExpression(expressionObj *expression, int itemindex, char **items, int numitems);

Modified: branches/branch-5-2/mapserver/maputil.c
===================================================================
--- branches/branch-5-2/mapserver/maputil.c	2008-09-23 21:20:08 UTC (rev 7925)
+++ branches/branch-5-2/mapserver/maputil.c	2008-09-25 19:30:26 UTC (rev 7926)
@@ -119,7 +119,7 @@
 /*
 ** Function to bind various layer properties to shape attributes.
 */
-int msBindLayerToShape(layerObj *layer, shapeObj *shape)
+int msBindLayerToShape(layerObj *layer, shapeObj *shape, int querymapMode)
 {
   int i, j;
   labelObj *label; /* for brevity */
@@ -150,12 +150,12 @@
           bindIntegerAttribute(&style->size, shape->values[style->bindings[MS_STYLE_BINDING_SIZE].index]);
         }
 
-        if(style->bindings[MS_STYLE_BINDING_COLOR].index != -1) {
+        if(style->bindings[MS_STYLE_BINDING_COLOR].index != -1 && (querymapMode != MS_TRUE)) {
           MS_INIT_COLOR(style->color, -1,-1,-1);
           bindColorAttribute(&style->color, shape->values[style->bindings[MS_STYLE_BINDING_COLOR].index]);
         }
 
-        if(style->bindings[MS_STYLE_BINDING_OUTLINECOLOR].index != -1) {
+        if(style->bindings[MS_STYLE_BINDING_OUTLINECOLOR].index != -1 && (querymapMode != MS_TRUE)) {
           MS_INIT_COLOR(style->outlinecolor, -1,-1,-1);
           bindColorAttribute(&style->outlinecolor, shape->values[style->bindings[MS_STYLE_BINDING_OUTLINECOLOR].index]);
         }



More information about the mapserver-commits mailing list