[mapserver-commits] r12873 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Thu Dec 8 08:56:51 EST 2011


Author: tbonfort
Date: 2011-12-08 05:56:51 -0800 (Thu, 08 Dec 2011)
New Revision: 12873

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapsymbol.c
Log:
fix vector symbol size calculation (#4116)


Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2011-12-08 13:01:09 UTC (rev 12872)
+++ trunk/mapserver/HISTORY.TXT	2011-12-08 13:56:51 UTC (rev 12873)
@@ -15,6 +15,8 @@
 Current Version (SVN trunk, 6.1-dev, future 6.2): 
 -------------------------------------------------
 
+- automatically translate vector symbol points (#4116)
+
 - Add RFC79 Layer masking (#4111)
 
 - Fixed single pixel coverages in WCS 2.0 (#4110)

Modified: trunk/mapserver/mapsymbol.c
===================================================================
--- trunk/mapserver/mapsymbol.c	2011-12-08 13:01:09 UTC (rev 12872)
+++ trunk/mapserver/mapsymbol.c	2011-12-08 13:56:51 UTC (rev 12873)
@@ -201,6 +201,27 @@
 	msSetError(MS_SYMERR, "Symbol of type VECTOR or ELLIPSE has no point data.", "loadSymbol()"); 
 	return(-1);
       }
+      if(s->type == MS_SYMBOL_VECTOR) {
+         double minx = s->points[0].x;
+         double miny = s->points[0].y;
+         int i;
+         for(i=1;i<s->numpoints;i++) {
+            if(s->points[i].x != -99 && s->points[i].y != -99) {
+               if(s->points[i].x<minx) minx = s->points[i].x;
+               if(s->points[i].y<miny) miny = s->points[i].y;
+            }
+         }
+         if(minx!=0 || miny!=0) {
+            for(i=0;i<s->numpoints;i++) {
+               if(s->points[i].x != -99 && s->points[i].y != -99) {
+                  s->points[i].x -= minx;
+                  s->points[i].y -= miny;
+               }
+            }
+            s->sizex -= minx;
+            s->sizey -= miny;
+         }
+      }
 
       return(0);
       break;



More information about the mapserver-commits mailing list