Are you trying something like:

Element e = document.getElementById (svgID);
Double x = Double.parseDouble(e..getAttributeNS(null, "x"));
Double y = Double.parseDouble(e..getAttributeNS(null, "y"));

Of course all that presumes that you have assigned your Elements unique IDs
such that getElementByID() has something to work with.

  Phil

On 12/4/06, vyang <[EMAIL PROTECTED]> wrote:


I tried something like yours, however I can't seem to get the coordinates
of
my rectangles when I moved them in JSVGCanvas.  How do I retrieve the
location/coordinates of the new rectangles from the canvas?



Phil Wright-2 wrote:
>
> Hi V,
>
> I do it this way:
>
>     public void moveTo(String svgID, Point2D.Double location, JSVGCanvas
> canvas) {
>         SVGDocument document = canvas.getSVGDocument();
>         final Element e = document.getElementById(svgID);
>         final Point2D.Double newLoc = location;
>
>         canvas.getUpdateManager
().getUpdateRunnableQueue().invokeLater(new
> Runnable() {
>             public void run() {
>                       e.setAttributeNS(null, "x", "" + newLoc.x);
>                       e.setAttributeNS(null, "y", "" + newLoc.y);
>              }
>          });
>     }
>
> This particular method is specifically for moving "rect"
elements.  Other
> elements can be handled similarly.
>
> Hope that helps,
>
>       Phil
>
> On 12/1/06, vyang <[EMAIL PROTECTED]> wrote:
>>
>>
>> Hello;
>>
>> I was wondering how I would update a document using JSVGCanvas.  I have
>> written a simple java file that creates a document that has 2
rectangles
>> in
>> them.  I then use JSVGCanvas to display it.  I load the document into
>> JSVGCanvas using setDocument().  Now what I want to do is that when I
>> move(or do things in JSVGCanvas) I would like that to update to my
>> document.
>> How would I go about doing that?  Any help would be much appreciated.
>> --
>> View this message in context:
>> http://www.nabble.com/JSVGCanvas-Update-tf2740725.html#a7646942
>> Sent from the Batik - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail:
[EMAIL PROTECTED]
>>
>>
>
>
> --
> Visit http://www.darkisle.com for photos of castles, cairns and other
> historic sites in the British Isles.
>
>

--
View this message in context:
http://www.nabble.com/JSVGCanvas-Update-tf2740725.html#a7684465
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Visit http://www.darkisle.com for photos of castles, cairns and other
historic sites in the British Isles.

Reply via email to