[mapserver-commits] r7959 - branches/branch-5-2/mapserver
svn at osgeo.org
svn at osgeo.org
Sun Oct 5 04:09:29 EDT 2008
Author: tbonfort
Date: 2008-10-05 04:09:29 -0400 (Sun, 05 Oct 2008)
New Revision: 7959
Modified:
branches/branch-5-2/mapserver/HISTORY.TXT
branches/branch-5-2/mapserver/maputil.c
Log:
fix some integer rounding errors in the agg line offseter (#2659)
Modified: branches/branch-5-2/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-5-2/mapserver/HISTORY.TXT 2008-10-05 08:03:12 UTC (rev 7958)
+++ branches/branch-5-2/mapserver/HISTORY.TXT 2008-10-05 08:09:29 UTC (rev 7959)
@@ -12,6 +12,8 @@
Current Version (SVN branch-5-2)
--------------------------------
+- fix some integer rounding errors in the agg line offseter (#2659)
+
- fix a bug with shapes with duplicate end points. was causing NaNs
in the angle follow placement code (#2695)
Modified: branches/branch-5-2/mapserver/maputil.c
===================================================================
--- branches/branch-5-2/mapserver/maputil.c 2008-10-05 08:03:12 UTC (rev 7958)
+++ branches/branch-5-2/mapserver/maputil.c 2008-10-05 08:09:29 UTC (rev 7959)
@@ -1467,7 +1467,7 @@
shapeObj* msOffsetPolyline(shapeObj *p, int offsetx, int offsety) {
int i, j, first,idx;
- int ox=0, oy=0, limit;
+ double ox=0, oy=0, limit;
double dx,dy,dx0=0, dy0=0,x, y, x0=0.0, y0=0.0, k=0.0, k0=0.0, q=0.0, q0=0.0;
float par=(float)0.71;
shapeObj *ret = (shapeObj*)malloc(sizeof(shapeObj));
@@ -1495,15 +1495,15 @@
}
ox=(dy>0) ? -offsetx : offsetx;
} else {
- k = (double)dy/(double)dx;
+ k = dy/dx;
if(MS_ABS(k)<0.5) {
oy = (dx>0) ? offsetx : -offsetx;
} else {
if (MS_ABS(k)<2.1) {
- oy = (int) ((dx>0) ? offsetx*par : -offsetx*par);
- ox = (int) ((dy>0) ? -offsetx*par : offsetx*par);
+ oy = (dx>0) ? offsetx*par : -offsetx*par;
+ ox = (dy>0) ? -offsetx*par : offsetx*par;
} else
- ox = (int)((dy>0) ? -offsetx : offsetx);
+ ox = (dy>0) ? -offsetx : offsetx;
}
q = p->line[i].point[j-1].y+oy - k*(p->line[i].point[j-1].x+ox);
}
More information about the mapserver-commits
mailing list