[mapserver-commits] r9131 - branches/branch-5-4/mapserver
svn at osgeo.org
svn at osgeo.org
Wed Jul 1 00:20:32 EDT 2009
Author: sdlime
Date: 2009-07-01 00:20:32 -0400 (Wed, 01 Jul 2009)
New Revision: 9131
Modified:
branches/branch-5-4/mapserver/HISTORY.TXT
branches/branch-5-4/mapserver/mapprimitive.c
Log:
Removed isOuterRing() test from getPolygonCenterOfGravity(), really slowed things down. (#3053)
Modified: branches/branch-5-4/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-5-4/mapserver/HISTORY.TXT 2009-06-30 14:53:49 UTC (rev 9130)
+++ branches/branch-5-4/mapserver/HISTORY.TXT 2009-07-01 04:20:32 UTC (rev 9131)
@@ -13,8 +13,12 @@
Current Version:
----------------
+
- Add centroid geomtransform (#2825)
+- Fixed performance bottleneck when computing a polygon center of gravity for
+ label point computation. (#3053)
+
- Save ALIGN parameter if it is set to CENTER or RIGHT (#3057)
- PHP: add a getResults method on the layer object (#2967)
Modified: branches/branch-5-4/mapserver/mapprimitive.c
===================================================================
--- branches/branch-5-4/mapserver/mapprimitive.c 2009-06-30 14:53:49 UTC (rev 9130)
+++ branches/branch-5-4/mapserver/mapprimitive.c 2009-07-01 04:20:32 UTC (rev 9131)
@@ -1010,22 +1010,20 @@
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);
-
- if(area > largestArea) {
- largestArea = area;
- sx = s>0?tsx:-tsx;
- sy = s>0?tsy:-tsy;
- }
+ 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;
+ }
}
lp->x = sx/(6*largestArea);
More information about the mapserver-commits
mailing list