Hi Peppe,

   Please reread my earliest response on this topic:
http://www.nabble.com/update-bounding-box-position-tf2786041.html#a7775398

   The code below doesn't "update" the bbox, the bbox is always correct,
it maps the bbox to another coordinate system (in the case below the
screen coordinate system).

   For your arrow function to work you probably want to map the corners of
the BBox to the coordinate system of the element you append the image
elements (referencing your arrow) to.

Peppe <[EMAIL PROTECTED]> wrote on 01/09/2007 06:41:56 AM:

> 
> To show better my problem i post a piece of code that i wrote:
> 
> private class OnMouseClick implements EventListener {
>            public void handleEvent(final Event evt) {
> 
> svgCanvas.getUpdateManager().getUpdateRunnableQueue().invokeLater(new
> Runnable() {
>                   public void run() {
>                      Element svgRoot = svgCanvas.getSVGDocument().
> getRootElement();
>                      DOMMouseEvent eleEvt = (DOMMouseEvent)evt;
>                      shape = (Element)eleEvt.getTarget();
> 
>                      //map bbox
>                          SVGMatrix mat = 
((SVGLocatable)shape).getScreenCTM();
>                         shapeBound = ((SVGLocatable)shape).getBBox();
>                         SVGMatrix imat = mat.inverse();
>                         bPt1 = doc.getRootElement().createSVGPoint();
>                         bPt1.setX(shapeBound.getX());
>                         bPt1.setY(shapeBound.getY());
>                         bPt1 = bPt1.matrixTransform(mat); 
>                         bPt2 = doc.getRootElement().createSVGPoint();
> bPt2.setX(shapeBound.getX()+shapeBound.getWidth());
>                         bPt2.setY(shapeBound.getY());
>                         bPt2 = bPt2.matrixTransform(mat); 
>                         bPt3 = doc.getRootElement().createSVGPoint();
>                         bPt3.setX(shapeBound.getX());
> bPt3.setY(shapeBound.getY()+shapeBound.getHeight());
>                         bPt3 = bPt3.matrixTransform(mat); 
>                         bPt4 = doc.getRootElement().createSVGPoint();
> bPt4.setX(shapeBound.getX()+shapeBound.getWidth());
> bPt4.setY(shapeBound.getY()+shapeBound.getHeight());
>                         bPt4 = bPt4.matrixTransform(mat); 
> 
> System.out.println(""+bPt1.getX()+","+bPt1.getY());
> 
>                                        arrow();
> }
> }
> 
> private class OnDownAction implements EventListener {
>            public void handleEvent(Event evt) {
>                             DOMMouseEvent elEvt = (DOMMouseEvent)evt; 
>                   actionNode = elEvt.getTarget();
>      .....
>     .....
> }
> }
> 
> private class OnMoveAction implements EventListener {
>            public void handleEvent(Event evt) {
>      .....
>     .....
> }
> }
> 
> private class OnUpAction implements EventListener {
>            public void handleEvent(Event evt) {
>                        //update bbox
>                    shape = (Element)actionNode;
>                   SVGMatrix mat = ((SVGLocatable)shape).getScreenCTM();
>                   shapeBound = ((SVGLocatable)shape).getBBox();
>                   //SVGMatrix imat = mat.inverse();
>                   bPt1 = doc.getRootElement().createSVGPoint();
>                   bPt1.setX(shapeBound.getX());
>                   bPt1.setY(shapeBound.getY());
>                   bPt1 = bPt1.matrixTransform(mat); 
>                   bPt2 = doc.getRootElement().createSVGPoint();
>                   bPt2.setX(shapeBound.getX()+shapeBound.getWidth());
>                   bPt2.setY(shapeBound.getY());
>                   bPt2 = bPt2.matrixTransform(mat); 
>                   bPt3 = doc.getRootElement().createSVGPoint();
>                   bPt3.setX(shapeBound.getX());
>                   bPt3.setY(shapeBound.getY()+shapeBound.getHeight());
>                   bPt3 = bPt3.matrixTransform(mat); 
>                   bPt4 = doc.getRootElement().createSVGPoint();
>                   bPt4.setX(shapeBound.getX()+shapeBound.getWidth());
>                   bPt4.setY(shapeBound.getY()+shapeBound.getHeight());
>                   bPt4 = bPt4.matrixTransform(mat); 
>                   System.out.println(""+bPt1.getX()+","+bPt1.getY());
> 
>                         arrow();
>      .....
>      .....
> }
> }
> 
> arrow is a method that add images of arrows around bbox....
> -- 
> View this message in context: http://www.nabble.com/map-coordinates-
> tf2938566.html#a8236113
> Sent from the Batik - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

Reply via email to