[mapserver-commits] r7956 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Sat Oct 4 11:37:16 EDT 2008


Author: tbonfort
Date: 2008-10-04 11:37:16 -0400 (Sat, 04 Oct 2008)
New Revision: 7956

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapagg.cpp
Log:
fix a bug with shapes with duplicate end points. was causing nans in the angle follow placement code (#2695)


Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2008-10-04 11:02:58 UTC (rev 7955)
+++ trunk/mapserver/HISTORY.TXT	2008-10-04 15:37:16 UTC (rev 7956)
@@ -11,6 +11,9 @@
 
 Current Version (5.3-dev, SVN trunk):
 ------------------------------------
+- fix a bug with shapes with duplicate end points. was causing nans
+  in the angle follow placement code (#2695)
+
 - refactor msGetLabelSizeEx (now merged with msGetLabelSize) (#2390)
 
 - native label size computation for AGG when using angle follow (#2357)

Modified: trunk/mapserver/mapagg.cpp
===================================================================
--- trunk/mapserver/mapagg.cpp	2008-10-04 11:02:58 UTC (rev 7955)
+++ trunk/mapserver/mapagg.cpp	2008-10-04 15:37:16 UTC (rev 7956)
@@ -2113,7 +2113,7 @@
         for (i = 0; i < labelpath->path.numpoints; i++) {
             double x, y;
             double theta;
-
+            
             if (msGetNextGlyph(&string_ptr, s) == -1)
                     break;  /* Premature end of string??? */
             
@@ -2463,10 +2463,15 @@
                 if(dx*dx+dy*dy>1)
                     k++;
             }
-            /*always keep last point*/
+            /*try to keep last point*/
             point[k].x = MS_MAP2IMAGE_X_IC_DBL(point[j].x, extent.minx, inv_cs);
             point[k].y = MS_MAP2IMAGE_Y_IC_DBL(point[j].y, extent.maxy, inv_cs);
-            shape->line[i].numpoints=k+1;
+            /*discard last point if equal to the one before it*/
+            if(point[k].x!=point[k-1].x || point[k].y!=point[k-1].y) {
+                shape->line[i].numpoints=k+1;
+            } else {
+                shape->line[i].numpoints=k;
+            }
         }
     }
     else if(shape->type == MS_SHAPE_POLYGON) {



More information about the mapserver-commits mailing list