Changeset 9131


Ignore:
Timestamp:
Jun 30, 2009 9:20:32 PM (7 years ago)
Author:
sdlime
Message:

Removed isOuterRing() test from getPolygonCenterOfGravity(), really slowed things down. (#3053)

Location:
branches/branch-5-4/mapserver
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/branch-5-4/mapserver/HISTORY.TXT

    r9119 r9131  
    1414Current Version:
    1515----------------
     16
    1617- Add centroid geomtransform (#2825)
     18
     19- Fixed performance bottleneck when computing a polygon center of gravity for
     20  label point computation. (#3053)
    1721
    1822- Save ALIGN parameter if it is set to CENTER or RIGHT (#3057)
  • branches/branch-5-4/mapserver/mapprimitive.c

    r9119 r9131  
    10111011
    10121012  for(i=0; i<p->numlines; i++) {
    1013     if(isOuterRing(p, i)) {
    1014       tsx = tsy = s = 0; /* reset the ring sums */
    1015       for(j=0; j<p->line[i].numpoints-1; j++) {
    1016         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;
    1017         s += a;
    1018         tsx += (p->line[i].point[j].x + p->line[i].point[j+1].x)*a;
    1019         tsy += (p->line[i].point[j].y + p->line[i].point[j+1].y)*a;
    1020       }
    1021       area = MS_ABS(s/2);
    1022 
    1023       if(area > largestArea) {
    1024         largestArea = area;
    1025         sx = s>0?tsx:-tsx;
    1026         sy = s>0?tsy:-tsy;
    1027       }
    1028     }
     1013    tsx = tsy = s = 0; /* reset the ring sums */
     1014    for(j=0; j<p->line[i].numpoints-1; j++) {
     1015      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;
     1016      s += a;
     1017      tsx += (p->line[i].point[j].x + p->line[i].point[j+1].x)*a;
     1018      tsy += (p->line[i].point[j].y + p->line[i].point[j+1].y)*a;
     1019    }
     1020    area = MS_ABS(s/2);
     1021
     1022    if(area > largestArea) {
     1023      largestArea = area;
     1024      sx = s>0?tsx:-tsx;
     1025      sy = s>0?tsy:-tsy;
     1026    } 
    10291027  }
    10301028
Note: See TracChangeset for help on using the changeset viewer.