xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cameron McCormack <cam-batik-us...@aka.mcc.id.au>
Subject Re: (Dummy) How to start batik browser from java source code?
Date Mon, 16 Jan 2006 00:37:00 GMT
Hey Eric.

Eric Yuan:
> This is just a dummy question from a beginner. actually what i need is
> a graphical tool for the "Travelling Salesman Problem" (TSP), it is
> graphically simple, only some nodes and arcs. mission is to visualize
> how e.g. a greedy algorithm is gonna select every next node, by
> showing a short movie or by interacting with mouse clicks. one
> possible way is, during running my java source code for TSP, call
> batik consecutively to display the state of the graph at each step.
> questions are:
> 
> 1, i can generate a svg file in java, but after that, how can i start
> the batik browser from java source? i know the way to start it from
> command line with "java -jar ...", but is there a way to call it from
> inside?

For your application you probably don't want to have the whole Squiggle
browser running.  Instead you can create your own JFrame and stick a
JSVGCanvas inside it.  The JSVGCanvas is the main SVG rendering
component that Squiggle uses.

  http://xml.apache.org/batik/svgcanvas.html

> 2, if the svg graph is only slightly changed, e.g. change the color of
> only one arc, do i have to regenerate a new svg file and restart the
> browser again? is there a faster way?

You can just update the document that is currently being displayed by
the JSVGCanvas using DOM calls.

  http://xml.apache.org/batik/domapi.html

> p.s. is there an svg tag showing directed arcs (with arrows)?

There is a 'line' element for straight lines, or 'path' for more complex
paths, and you can use the marker-end property to give it an arrow head.
For example:

  http://www.w3.org/TR/SVG11/painting.html#MarkersIntroduction

Cameron

-- 
 Cameron McCormack			ICQ: 26955922
 cam (at) mcc.id.au			MSN: cam (at) mcc.id.au
 http://mcc.id.au/			JBR: heycam (at) jabber.org

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message