[mapserver-commits] r10737 - sandbox/mapserver6

svn at osgeo.org svn at osgeo.org
Fri Nov 19 09:25:35 EST 2010


Author: tbonfort
Date: 2010-11-19 06:25:35 -0800 (Fri, 19 Nov 2010)
New Revision: 10737

Modified:
   sandbox/mapserver6/mapprimitive.c
Log:
avoid superfluous test when computing overlap angle in FOLLOW labels

Modified: sandbox/mapserver6/mapprimitive.c
===================================================================
--- sandbox/mapserver6/mapprimitive.c	2010-11-19 13:54:15 UTC (rev 10736)
+++ sandbox/mapserver6/mapprimitive.c	2010-11-19 14:25:35 UTC (rev 10737)
@@ -1734,7 +1734,7 @@
   int kernel_size = 5;
   
   double letterspacing = 1.25;
-  double maxoverlapangle = 0;;
+  double maxoverlapangle = 0.4 * MS_PI;
 
   offsets = NULL;
 
@@ -1810,9 +1810,10 @@
     label_repeat = 1;
     center_label_position = (line_length - text_length) / 2.0;
   }
+  
+  if(label->maxoverlapangle)
+     maxoverlapangle = label->maxoverlapangle/(180/MS_PI); // radian
 
-  maxoverlapangle = label->maxoverlapangle/(180/MS_PI); // radian
-
   for (l=0; l < label_repeat; l++)
   {
     if (l == label_repeat-1) { // last label to place is always the center label
@@ -2000,10 +2001,10 @@
 
             theta = -atan2(dy,dx);
 
-            /* If the difference between subsequent angles is > 80% of 180deg
-               bail because the line likely overlaps itself. */
-   
-            if ( k > 2 && fabs(theta - labelpath->angles[k-2]) > 0.4 * MS_PI ) {
+            /* If the difference between the last char angle and the current one 
+              is greater than the MAXOVERLAPANGLE value (set at 80% of 180deg by default)
+              , bail the label */
+            if ( k > 2 && fabs(theta - labelpath->angles[k-2]) > maxoverlapangle ) {
                 goto LABEL_FAILURE;
             }
       
@@ -2011,13 +2012,6 @@
             
             labelpath->angles[k-1] = theta;
 
-            /* If the difference between the last char angle and the current one 
-               is greater than the MAXOVERLAPANGLE value, bail the label */
-            if ( (maxoverlapangle != 0) && (k>1) && 
-                 (fabs(labelpath->angles[k-1]-labelpath->angles[k-2]) > fabs(maxoverlapangle)) )
-            {
-                goto LABEL_FAILURE;
-            }
   
             /* Move the previous point so that when the character is rotated and
                placed it is centred on the line */



More information about the mapserver-commits mailing list