[mapserver-commits] r9986 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Mon Mar 22 17:02:44 EDT 2010


Author: assefa
Date: 2010-03-22 17:02:42 -0400 (Mon, 22 Mar 2010)
New Revision: 9986

Modified:
   trunk/mapserver/maplegend.c
Log:
Correct GetLegendGraphic using keyimage #3398

Modified: trunk/mapserver/maplegend.c
===================================================================
--- trunk/mapserver/maplegend.c	2010-03-22 20:51:41 UTC (rev 9985)
+++ trunk/mapserver/maplegend.c	2010-03-22 21:02:42 UTC (rev 9986)
@@ -121,13 +121,22 @@
     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);
+
       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