Hi Arvinder,
What is the purpose of this dot / these dots?
* if the purpose is keep stateful information inside the SVG (e.g., you want
to save the coordinates as part of the SVG), then the best bet is to
modify the DOM as suggested by many:
JSVGCanvas canvas = ...; // create canvas or JSVGComponent, etc.
Element circle = canvas.getSVGDocument().createElement("circle"); // create
circle --- not yet attached to anything
circle.setAttribute("r", "3"); // set radius of circle
circle.setAttribute("cx", "10"); // set x-coord of circle
circle.setAttribute("cy, "12"); // set y-coord of circle
canvas.getUpdateManager().getRunnableQueue().add( new Runnable() {
public void run() {
// add circle to SVG
canvas.getSVGDocument().getRootElement().appendChild(circle);
}
});
* if the purpose is simply to display (dynamically) some dots as the user
moves the cursor or whatnot, then the Overlay you were asking about is
probably the easiest way.
public static void main(.....) {
final JSVGCanvas canvas = ....;
class Blah implements Overlay {
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
AffineTransform oldAt = g2d.getTransform();
g2d.transform(mySvgCanvas.getRenderingTransform());
// do painting
g2d.drawCircle(......);
// reset graphics, so other overlays draw correctly
g2d.setTransform(oldAT);
}
}
canvas.getOverlays().add(new Blah());
}
Good luck!
- Bob
On Mon, 5 Jan 2004, Arvinder Singh wrote:
> Hi,
>
> I'm new to Batik/SVG, and i'm trying to develop a java application using
> batik that will load a svg file, display it, and then display a dot
> (or any other simple graphic) on top of that svg at specified co-
> ordinates.
>
> Upto now i have been sucessful in gettign the SVG file to display, but i
> don't know how to add something on top of that. Any information would
> be appreciated.
>
> Thanks,
>
> -Andy
>
> PS: My email program froze on me when i send my previous message and i'm
> not sure if it went through so i'm sending this out again. I am sorry if
> you got 2 identical emails from me.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]