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]