Re: [argouml-dev] Using batik for SVG

Tom Morris <[email protected]>
Newsgroups gmane.comp.db.axion.devel
Message-ID <[email protected]>
On Mon, May 16, 2011 at 5:30 PM, Bob Tarling <[email protected]> wrote:
> To hopefully answer the comments of both Tom and Thomas -
>
> I'm only raising this because there seemed to be some criticism of my
> plans to do this previously.
>
> This is nothing to do with replacing the PGML stored in the zargo with SVG.
>
> It is actually only replacing one class in GEF but that replacement
> adds several jar batik jar files to our download.
>
> That class being replaced is the one called in ArgoUML when doing
> File->ExportGraphics and chooisng a file type of SVG.
>
> All other Java2D classes in the system use Graphics2D but GEF goes
> back to such an old age that it only uses the Graphics class for its
> SVGWriter.
>
> As a result all methods in GEF of that use a Graphics class have to
> assume that this might not be a Graphics2D class and contain
> conditions like this in FigLine
>
>    public int drawDashedLine(Graphics g, int lineWidth, int x1, int y1,
>            int x2, int y2, int phase, float[] dashes, int dashPeriod) {
>        if (g instanceof Graphics2D) {
>            return drawDashedLineG2D((Graphics2D) g, lineWidth, phase, x1, y1,
>                    x2, y2, dashes, dashPeriod);
>        }
>        // There follows from here lots of code to handle the (g
> instance of Graphics) that is only applicable to SVGWriter
>        //.....
>        //.....
>        ....
>        ..
>    }
>
> I think all modern Java code can assume Graphics2D is the Graphics
> class being used and it is only the ancient SVGWriter that prevents
> this in GEF.
>
> Once we have that class replaced in GEF with the Batik equivalent then
> the conditional code above can also be removed from many GEF classes.
> This also fixes a few defects in GEF (e.g.
> http://gef.tigris.org/issues/show_bug.cgi?id=339).
>
> I had previously proposed using batik but it had been suggested that
> updating the SVGWriter class would be a fairly simple task. So I held
> back hoping that work would happen.

OK, so the proposal is to replace
org.tigris.gef.persistence.SvgWriter2D with Batik and delete
org.argouml.uml.ui.SaveSVGAction2?

I literally haven't looked at the prototype that I put together in
years, so you are probably more familiar with the tradeoffs than I am,
but I thought all the basics were implemented.  It's far from a full
implemented of Graphics2D, but since GEF uses so little of it, I
thought most of what GEF uses was implemented.  Could be faulty memory
though...

I think it's your decision to make either way though.

Tom

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=450&dsMessageId=2738342

To unsubscribe from this discussion, e-mail: [[email protected]].
To be allowed to post to the list contact the mailing list moderator, email: [[email protected]]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.