Great! When I was looking at it to answer your post, I realized that I had some useless code in the Linestring PathIterator. It is much simpler now and much more light weight.
class LineStringPath implements PathIterator { private int iterate; private int numPoints; private Coordinate[] points; private boolean closed; public LineStringPath(LineString linestring, Java2DConverter j2D){ try { points = j2D.toViewCoordinates(linestring.getCoordinates()); } catch (NoninvertibleTransformException ex){ } this.numPoints = points.length; iterate = 0; closed = (numPoints>1) && (points[0].equals2D(points[numPoints-1])); } private int getSegType(){ if (closed && (iterate == numPoints-1)) return PathIterator.SEG_CLOSE; return (iterate==0) ? PathIterator.SEG_MOVETO : PathIterator.SEG_LINETO; } public int currentSegment(double[] coords) { coords[0] = points[iterate].x; coords[1] = points[iterate].y; return getSegType(); } public int currentSegment(float[] coords) { coords[0] = (float) points[iterate].x; coords[1] = (float) points[iterate].y; return getSegType(); } public int getWindingRule() { return GeneralPath.WIND_NON_ZERO; } public boolean isDone() { return !(iterate < numPoints); } public void next() { iterate++; } } regards, Larry On 7/13/07, Michaël Michaud <[EMAIL PROTECTED]> wrote: > Hello, > > Yes, the patch on the linestring has no effect on a polygon, but the > patch on the polygon has :-) > It is now commited for both cases. > I did not patch classes to use double instead of float yet (but I have > no objection if someone who understand and/or need it commit) > > Michaël > > > Larry Becker a écrit : > > >> I read that PathIterator.SEG_CLOSE add a segment back to the point > >> corresponding to the most recent SEG_MOVETO. > >> In our case, this segment already exists because the linestring is > >> closed. > > > > > > The linestring is closed, but Java2D won't build a bevel without the > > SEG_CLOSE on the last segment. If it is closed, then it just won't > > need to explicitly close it for us. > > > > By the way, JUMP didn't originally close linestrings, just polygons. > > See the attached Thicklines.png. I think it looks much better now > > (see After.png). > > > > regards, > > Larry > > > > > > On 7/13/07, Michaël Michaud <[EMAIL PROTECTED]> wrote: > > > >> Hi, > >> > >> I tested this one, but it did not change the result for me. > >> The JOIN_BEVEL appears and desappears depending on scale in both cases, > >> with old code and with your patch. > >> > >> I read that PathIterator.SEG_CLOSE add a segment back to the point > >> corresponding to the most recent SEG_MOVETO. > >> In our case, this segment already exists because the linestring is > >> closed. Will we have to trace one more segment (over the first one) ? > >> How your code is supposed to change the join type? > >> > >> Michaël > >> > >> > >> Larry Becker a écrit : > >> > >> >We recently implemented some modifications to Java2DConverter and > >> >PolygonShape to use PathIterator. The implementation was slightly > >> >flawed and resulted in paths that didn't use a SEG_CLOSE which causes > >> >closed paths to fail to connect start and end with a JOIN_BEVEL. You > >> >can see the problem very easily if you start OJ, drag out a rectangle, > >> >and then increase the line width to 10. > >> > > >> >The fix is: > >> > > >> > private int getSegType(){ > >> > if (closed && (iterate == numPoints-1)) > >> > return PathIterator.SEG_CLOSE; > >> > return (iterate==0) ? PathIterator.SEG_MOVETO > >> : PathIterator.SEG_LINETO; > >> > } > >> > > >> >I would also like to increase the accuracy of the rendering system > >> >from float to double by replacing all references to GeneralPath with > >> >Path2D.Double. There is no speed or memory penalty for this change. > >> > > >> >regards, > >> >Larry Becker > >> > > >> > > >> > > >> > >> > >> ------------------------------------------------------------------------- > >> > >> This SF.net email is sponsored by DB2 Express > >> Download DB2 Express C - the FREE version of DB2 express and take > >> control of your XML. No limits. Just data. Click to get it now. > >> http://sourceforge.net/powerbar/db2/ > >> _______________________________________________ > >> Jump-pilot-devel mailing list > >> Jump-pilot-devel@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > >> > > > > > > > > ------------------------------------------------------------------------ > > > > > > ------------------------------------------------------------------------ > > > >------------------------------------------------------------------------ > > > >------------------------------------------------------------------------- > >This SF.net email is sponsored by DB2 Express > >Download DB2 Express C - the FREE version of DB2 express and take > >control of your XML. No limits. Just data. Click to get it now. > >http://sourceforge.net/powerbar/db2/ > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Jump-pilot-devel mailing list > >Jump-pilot-devel@lists.sourceforge.net > >https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > -- http://amusingprogrammer.blogspot.com/ ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel