[mapserver-commits] r10015 - branches/branch-5-6/mapserver

svn at osgeo.org svn at osgeo.org
Thu Mar 25 11:49:09 EDT 2010


Author: assefa
Date: 2010-03-25 11:49:05 -0400 (Thu, 25 Mar 2010)
New Revision: 10015

Modified:
   branches/branch-5-6/mapserver/HISTORY.TXT
   branches/branch-5-6/mapserver/maplegend.c
Log:
Fix GetLegendGraphic using keyimages (#3398)

Modified: branches/branch-5-6/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-5-6/mapserver/HISTORY.TXT	2010-03-25 15:22:08 UTC (rev 10014)
+++ branches/branch-5-6/mapserver/HISTORY.TXT	2010-03-25 15:49:05 UTC (rev 10015)
@@ -15,6 +15,8 @@
 Version 5.6.4 (????-??-??):
 ---------------------------
 
+- Fix GetLegendGraphic using keyimages (#3398)
+
 - Fix getFeatureInfo quries on WFS layers (#3403)
 
 - Fixed mapstring.c build problem related to errno (#3401).

Modified: branches/branch-5-6/mapserver/maplegend.c
===================================================================
--- branches/branch-5-6/mapserver/maplegend.c	2010-03-25 15:22:08 UTC (rev 10014)
+++ branches/branch-5-6/mapserver/maplegend.c	2010-03-25 15:49:05 UTC (rev 10015)
@@ -121,13 +121,25 @@
     if(theclass->keyimage != NULL) {
       int symbolNum;
       styleObj imgStyle;
+      symbolObj *symbol=NULL;
       symbolNum = msAddImageSymbol(&(map->symbolset), msBuildPath(szPath, map->mappath, theclass->keyimage));
       if(symbolNum == -1) { 
           msSetError(MS_GDERR, "Failed to open legend key image", "msCreateLegendIcon()");
           return(MS_FAILURE);
       }
+      
+      symbol = map->symbolset.symbol[symbolNum];
+      
       initStyle(&imgStyle);
-      imgStyle.size = width;
+      /*set size so thet symbol will be scaled properly #3296*/
+      if (width/symbol->sizex < height/symbol->sizey)
+        imgStyle.size = symbol->sizey*(width/symbol->sizex);
+      else
+        imgStyle.size = symbol->sizey*(height/symbol->sizey);
+
+      if (imgStyle.size > imgStyle.maxsize)
+        imgStyle.maxsize = imgStyle.size;
+
       imgStyle.symbol = symbolNum;
       msDrawMarkerSymbol(&map->symbolset,image,&marker,&imgStyle,lp->scalefactor);
       /* TO DO: we may want to handle this differently depending on the relative size of the keyimage */



More information about the mapserver-commits mailing list