The Artima Developer Community
Sponsored Link

Java Buzz Forum
Sequence Diagrams in DocBook Documents via UMLGraph and SVG

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Paul Brown

Posts: 284
Nickname: paulrbrown
Registered: Dec, 2003

Paul Brown is an entrepreneur
Sequence Diagrams in DocBook Documents via UMLGraph and SVG Posted: Aug 15, 2004 7:49 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Paul Brown.
Original Post: Sequence Diagrams in DocBook Documents via UMLGraph and SVG
Feed Title: mult.ifario.us
Feed URL: http://feeds.feedburner.com/MultifariousCategoryJava
Feed Description: Software. Business. Java. XML. Web Services.
Latest Java Buzz Posts
Latest Java Buzz Posts by Paul Brown
Latest Posts From mult.ifario.us

Advertisement
UMLGraph is a great tool from Diomidis Spinellis that uses GraphViz and the GNU plotutils package for "the declarative specification of UML class and sequence diagrams". My initial thought was that this would make it possible to insert sequence diagrams into DocBook documentation without human intervention, and it comes close.There are a couple of twists and turns required to get a properly cropped SVG image.The first obstacle is getting the pic2plot utility to work with Ant. The Ant <apply> task can run a command against a group of files, but it doesn't have the ability to redirect standard out to a target file on each iteration. (How could such an obvious use case get missed? Most UNIX commandline tools take input from standard in and produce output to standard out, as they should. Not being able to capture standard out on a iteration-by-iteration basis is silly.) The solution is an ugly hack that uses the <for> and <variable> tasks from the ant-contrib project.The second obstacle is that the XSL-FO engine I'm using requires that the SVG document be in the SVG namespace. but Ant makes it relatively easy to insert the SVG namespace into the SVG document, like so:<replace file="${generated.images.dir}/${lang}/${output}.svg" token="&lt;svg" value="&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot;" />CAVEAT: This is really an awful thing to do; manipulating XML markup as text is generally a bad idea, but this particular case hardly merits writing an XSLT.The third obstacle, and the one that makes it impossible to work on a purely declarative basis, is that the SVG that gets generated is always 8"x8", no matter what dimensions are specified in the sequence diagram script. It is possible to traverse an SVG document and compute a minimal clipping rectangle (based on the points referenced), but I couldn't find anyone who'd done it already. One solution is to load the documents into Batik's "squiggle" viewer and then use the reporting of the cursor's canvas coordinates to compute a viewport for insertion into the <svg> element.For example, if the bounding box should have corners (0.05,0.33) and (0.95,0.67) according to the coordinates that squiggle reports, the attributes on the <svg> element would read:<svg xmlns="http://www.w3.org/2000/svg" width="7.2in" height="2.72" viewbox="0.05 0.33 0.9 0.34" preserveAspectRatio="none">In the end, the results are worth the trouble:

Read: Sequence Diagrams in DocBook Documents via UMLGraph and SVG

Topic: [Aug 5, 2004 11:24 PDT] 24 Links Previous Topic   Next Topic Topic: Microsoft launches Web log service in Japan

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use