[mapserver-commits] r10383 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Thu Jul 22 12:37:33 EDT 2010


Author: sdlime
Date: 2010-07-22 16:37:33 +0000 (Thu, 22 Jul 2010)
New Revision: 10383

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/maptemplate.c
Log:
Added coordinate scaling to shpxy tag via parameters scale, scale_x or scale_y.

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2010-07-22 10:11:39 UTC (rev 10382)
+++ trunk/mapserver/HISTORY.TXT	2010-07-22 16:37:33 UTC (rev 10383)
@@ -13,6 +13,8 @@
 
 Current Version (SVN trunk):
 ----------------------------
+- Added coordinate scaling to shpxy tag via parameters scale, scale_x or scale_y.
+
 - Fix computation of shape bounds when the first line contains no points
   (#3119)(fixes #3383)
 

Modified: trunk/mapserver/maptemplate.c
===================================================================
--- trunk/mapserver/maptemplate.c	2010-07-22 10:11:39 UTC (rev 10382)
+++ trunk/mapserver/maptemplate.c	2010-07-22 16:37:33 UTC (rev 10383)
@@ -1832,6 +1832,8 @@
   int centroid;
   int precision;
 
+  double scale_x, scale_y;
+
   double buffer;
   int bufferUnits;
 
@@ -1866,6 +1868,7 @@
 
     centroid = MS_FALSE;
     precision = 0;
+    scale_x = scale_y = 1.0;
 
     buffer = 0;
     bufferUnits = -1;
@@ -1911,6 +1914,18 @@
       argValue = msLookupHashTable(tagArgs, "precision");
       if(argValue) precision = atoi(argValue);
 
+      argValue = msLookupHashTable(tagArgs, "scale");
+      if(argValue) { 
+        scale_x = atof(argValue);
+        scale_y = scale_x;
+      }
+
+      argValue = msLookupHashTable(tagArgs, "scale_x");
+      if(argValue) scale_x = atof(argValue);
+
+      argValue = msLookupHashTable(tagArgs, "scale_y");
+      if(argValue) scale_y = atof(argValue);
+
       argValue = msLookupHashTable(tagArgs, "centroid");
       if(argValue) 
         if(strcasecmp(argValue,"true") == 0) centroid = MS_TRUE;
@@ -2026,11 +2041,11 @@
 
       if(strlen(ph) > 0) coords = msStringConcatenate(coords, ph);
       for(j=0; j<tShape.line[i].numpoints-1; j++) {
-        snprintf(point, 128, pointFormat1, tShape.line[i].point[j].x, tShape.line[i].point[j].y);
-        coords = msStringConcatenate(coords, point);  
+        snprintf(point, 128, pointFormat1, scale_x*tShape.line[i].point[j].x, scale_y*tShape.line[i].point[j].y);
+        coords = msStringConcatenate(coords, point);
       }
-      snprintf(point, 128, pointFormat2, tShape.line[i].point[j].x, tShape.line[i].point[j].y);
-      coords = msStringConcatenate(coords, point);  
+      snprintf(point, 128, pointFormat2, scale_x*tShape.line[i].point[j].x, scale_y*tShape.line[i].point[j].y);
+      coords = msStringConcatenate(coords, point);
       if(strlen(pf) > 0) coords = msStringConcatenate(coords, pf);
       if((i < tShape.numlines-1) && (strlen(ps) > 0)) coords = msStringConcatenate(coords, ps);
     }



More information about the mapserver-commits mailing list