[mapserver-commits] r9588 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Mon Dec 7 12:00:43 EST 2009


Author: aboudreault
Date: 2009-12-07 12:00:41 -0500 (Mon, 07 Dec 2009)
New Revision: 9588

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/maplegend.c
Log:
Fixed HTML legend image samples truncated (#2636)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2009-12-07 16:10:12 UTC (rev 9587)
+++ trunk/mapserver/HISTORY.TXT	2009-12-07 17:00:41 UTC (rev 9588)
@@ -14,6 +14,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Fixed HTML legend image samples truncated (#2636)
+
 - WMS GetFeatureInfo should respect the scale like GetMap does (#842)
 
 - Filter encoding: simple filters using propertyislike not applied properly

Modified: trunk/mapserver/maplegend.c
===================================================================
--- trunk/mapserver/maplegend.c	2009-12-07 16:10:12 UTC (rev 9587)
+++ trunk/mapserver/maplegend.c	2009-12-07 17:00:41 UTC (rev 9588)
@@ -44,6 +44,7 @@
         int width, int height, imageObj *image, int dstX, int dstY)
 {
   int i, type;
+  double offset;
   shapeObj box, zigzag;
   pointObj marker;
   char szPath[MS_MAXPATHLEN];
@@ -54,7 +55,6 @@
 	if(MS_VALID_COLOR(map->legend.outlinecolor))
 	  gdImageSetClip(image->img.gd, dstX, dstY, dstX + width - 1, dstY + height - 1);
   
-
   /* initialize the box used for polygons and for outlines */
   box.line = (lineObj *)malloc(sizeof(lineObj));
   box.numlines = 1;
@@ -137,19 +137,24 @@
     }
     break;
   case MS_LAYER_LINE:
+    offset = 1;
+    /* To set the offset, we only check the size/width parameter of the first style */
+    if (theclass->numstyles > 0) {
+      offset = (theclass->styles[0]->size != -1) ? theclass->styles[0]->size/2 : theclass->styles[0]->width/2;
+    }
     zigzag.line = (lineObj *)malloc(sizeof(lineObj));
     zigzag.numlines = 1;
     zigzag.line[0].point = (pointObj *)malloc(sizeof(pointObj)*4);
     zigzag.line[0].numpoints = 4;
 
-    zigzag.line[0].point[0].x = dstX;
-    zigzag.line[0].point[0].y = dstY + height - 1;
+    zigzag.line[0].point[0].x = dstX + offset;
+    zigzag.line[0].point[0].y = dstY + height - offset;
     zigzag.line[0].point[1].x = dstX + MS_NINT(width / 3.0) - 1; 
-    zigzag.line[0].point[1].y = dstY;
+    zigzag.line[0].point[1].y = dstY + offset;
     zigzag.line[0].point[2].x = dstX + MS_NINT(2.0 * width / 3.0) - 1; 
-    zigzag.line[0].point[2].y = dstY + height - 1; 
-    zigzag.line[0].point[3].x = dstX + width - 1; 
-    zigzag.line[0].point[3].y = dstY; 
+    zigzag.line[0].point[2].y = dstY + height - offset; 
+    zigzag.line[0].point[3].x = dstX + width - offset; 
+    zigzag.line[0].point[3].y = dstY + offset;
 
     for(i=0; i<theclass->numstyles; i++)
       msDrawLineSymbol(&map->symbolset, image, &zigzag, theclass->styles[i], lp->scalefactor); 



More information about the mapserver-commits mailing list