[mapserver-commits] r9132 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Wed Jul 1 00:24:11 EDT 2009


Author: sdlime
Date: 2009-07-01 00:24:11 -0400 (Wed, 01 Jul 2009)
New Revision: 9132

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapprimitive.c
Log:
Removed isOuterRing() test from getPolygonCenterOfGravity(), really slowed things down. (#3053)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2009-07-01 04:20:32 UTC (rev 9131)
+++ trunk/mapserver/HISTORY.TXT	2009-07-01 04:24:11 UTC (rev 9132)
@@ -13,9 +13,13 @@
 
 Current Version (SVN trunk):
 ----------------------------
+
 - remove -O optimization flags to configure script if configured
   with --enable-debug
 
+- Fixed performance bottleneck when computing a polygon center of gravity for
+  label point computation. (#3053)
+
 - make WFS numberOfFeatures match maxFeatures if passed (#2907)
 
 - Add logging in layer visibility tests to help users find why layers don't draw (#3054)

Modified: trunk/mapserver/mapprimitive.c
===================================================================
--- trunk/mapserver/mapprimitive.c	2009-07-01 04:20:32 UTC (rev 9131)
+++ trunk/mapserver/mapprimitive.c	2009-07-01 04:24:11 UTC (rev 9132)
@@ -1011,21 +1011,19 @@
   double largestArea=0;
 
   for(i=0; i<p->numlines; i++) {
-    if(isOuterRing(p, i)) {
-      tsx = tsy = s = 0; /* reset the ring sums */
-      for(j=0; j<p->line[i].numpoints-1; j++) {
-        a = p->line[i].point[j].x*p->line[i].point[j+1].y - p->line[i].point[j+1].x*p->line[i].point[j].y;
-        s += a;
-        tsx += (p->line[i].point[j].x + p->line[i].point[j+1].x)*a;
-        tsy += (p->line[i].point[j].y + p->line[i].point[j+1].y)*a;
-      }
-      area = MS_ABS(s/2);
+    tsx = tsy = s = 0; /* reset the ring sums */
+    for(j=0; j<p->line[i].numpoints-1; j++) {
+      a = p->line[i].point[j].x*p->line[i].point[j+1].y - p->line[i].point[j+1].x*p->line[i].point[j].y;
+      s += a;
+      tsx += (p->line[i].point[j].x + p->line[i].point[j+1].x)*a;
+      tsy += (p->line[i].point[j].y + p->line[i].point[j+1].y)*a;
+    }
+    area = MS_ABS(s/2);
 
-      if(area > largestArea) {
-        largestArea = area;
-        sx = s>0?tsx:-tsx;
-        sy = s>0?tsy:-tsy;
-      }
+    if(area > largestArea) {
+      largestArea = area;
+      sx = s>0?tsx:-tsx;
+      sy = s>0?tsy:-tsy;
     }
   }
 



More information about the mapserver-commits mailing list