[mapserver-commits] r7922 - in trunk/mapserver: . mapscript/php3 mapscript/swiginc

svn at osgeo.org svn at osgeo.org
Tue Sep 23 11:51:45 EDT 2008


Author: aboudreault
Date: 2008-09-23 11:51:45 -0400 (Tue, 23 Sep 2008)
New Revision: 7922

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapchart.c
   trunk/mapserver/mapdraw.c
   trunk/mapserver/mapscript/php3/mapscript_i.c
   trunk/mapserver/mapscript/swiginc/rect.i
   trunk/mapserver/mapscript/swiginc/shape.i
   trunk/mapserver/mapserver.h
   trunk/mapserver/maputil.c
Log:
Fix bug when QUERYMAP hilite color is set and the shape's color in a
layer is from a data source (#2769)


Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2008-09-23 14:34:39 UTC (rev 7921)
+++ trunk/mapserver/HISTORY.TXT	2008-09-23 15:51:45 UTC (rev 7922)
@@ -12,6 +12,9 @@
 Current Version (5.3-dev, SVN trunk):
 ------------------------------------
 
+- Fixed bug when QUERYMAP hilite color is set and the shape's color in a
+  layer is from a data source (#2769)
+
 - Decoupled AUTO label placement from the positions enum in mapserver.h. Added 
   explicit case for POLYGON layers where CC is the default and then we try UC, 
   LC, CL and CR. (#2770)

Modified: trunk/mapserver/mapchart.c
===================================================================
--- trunk/mapserver/mapchart.c	2008-09-23 14:34:39 UTC (rev 7921)
+++ trunk/mapserver/mapchart.c	2008-09-23 15:51:45 UTC (rev 7922)
@@ -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: trunk/mapserver/mapdraw.c
===================================================================
--- trunk/mapserver/mapdraw.c	2008-09-23 14:34:39 UTC (rev 7921)
+++ trunk/mapserver/mapdraw.c	2008-09-23 15:51:45 UTC (rev 7922)
@@ -909,9 +909,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;
@@ -1105,9 +1105,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);
@@ -1280,9 +1280,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;
@@ -1342,7 +1343,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: trunk/mapserver/mapscript/php3/mapscript_i.c
===================================================================
--- trunk/mapserver/mapscript/php3/mapscript_i.c	2008-09-23 14:34:39 UTC (rev 7921)
+++ trunk/mapserver/mapscript/php3/mapscript_i.c	2008-09-23 15:51:45 UTC (rev 7922)
@@ -836,7 +836,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) {
@@ -1050,7 +1050,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: trunk/mapserver/mapscript/swiginc/rect.i
===================================================================
--- trunk/mapserver/mapscript/swiginc/rect.i	2008-09-23 14:34:39 UTC (rev 7921)
+++ trunk/mapserver/mapscript/swiginc/rect.i	2008-09-23 15:51:45 UTC (rev 7922)
@@ -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: trunk/mapserver/mapscript/swiginc/shape.i
===================================================================
--- trunk/mapserver/mapscript/swiginc/shape.i	2008-09-23 14:34:39 UTC (rev 7921)
+++ trunk/mapserver/mapscript/swiginc/shape.i	2008-09-23 15:51:45 UTC (rev 7922)
@@ -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: trunk/mapserver/mapserver.h
===================================================================
--- trunk/mapserver/mapserver.h	2008-09-23 14:34:39 UTC (rev 7921)
+++ trunk/mapserver/mapserver.h	2008-09-23 15:51:45 UTC (rev 7922)
@@ -1838,7 +1838,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*/
@@ -1991,7 +1991,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: trunk/mapserver/maputil.c
===================================================================
--- trunk/mapserver/maputil.c	2008-09-23 14:34:39 UTC (rev 7921)
+++ trunk/mapserver/maputil.c	2008-09-23 15:51:45 UTC (rev 7922)
@@ -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 @@
           bindDoubleAttribute(&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