@@ -0,0 +1,1475 @@
+package de.lmu.ifi.dbs.elki.visualization.batikutil;%0A%0Aimport org.apache.batik.dom.events.DOMMouseEvent;%0Aimport org.w3c.dom.Element;%0Aimport org.w3c.dom.events.Event;%0Aimport org.w3c.dom.svg.SVGElement;%0Aimport org.w3c.dom.svg.SVGLocatable;%0Aimport org.w3c.dom.svg.SVGMatrix;%0Aimport org.w3c.dom.svg.SVGPoint;%0A%0A/**%0A * Batik helper class with static methods.%0A * %0A * @author Erich Schubert%0A */%0Apublic final class BatikUtil %7B%0A  /**%0A   * Get the relative coordinates of a point within the coordinate system of a%0A   * particular SVG Element.%0A   * %0A   * @param evt Event, needs to be a DOMMouseEvent%0A   * @param reference SVG Element the coordinate system is used of%0A   * @return Array containing the X and Y values%0A   */%0A  public static double%5B%5D getRelativeCoordinates(Event evt, Element reference) %7B%0A    if(evt instanceof DOMMouseEvent && reference instanceof SVGLocatable && reference instanceof SVGElement) %7B%0A      // Get the screen (pixel!) coordinates%0A      DOMMouseEvent gnme = (DOMMouseEvent) evt;%0A      SVGMatrix mat = ((SVGLocatable) reference).getScreenCTM();%0A      SVGMatrix imat = mat.inverse();%0A      SVGPoint cPt = ((SVGElement) reference).getOwnerSVGElement().createSVGPoint();%0A      cPt.setX(gnme.getClientX());%0A      cPt.setY(gnme.getClientY());%0A      // Have Batik transform the screen (pixel!) coordinates into SVG element%0A      // coordinates%0A      cPt = cPt.matrixTransform(imat);%0A%0A      return new double%5B%5D %7B cPt.getX(), cPt.getY() %7D;%0A    %7D%0A    return null;%0A  %7D%0A%7D%0A

Add a BatikUtil class with a static method do perform an event-to-local-coordinates transformation.