Search in sources :

Example 1 with SVGOMRect

use of org.apache.batik.dom.svg.SVGOMRect in project scout.rt by eclipse.

the class SVGUtility method getElementsAt.

public static List<Element> getElementsAt(SVGDocument doc, SVGPoint point) {
    ArrayList<Element> list = new ArrayList<Element>();
    SVGOMRect svgOMRect = new SVGOMRect(point.getX(), point.getY(), 1, 1);
    NodeList intersectedElements = doc.getRootElement().getIntersectionList(svgOMRect, null);
    int n = intersectedElements.getLength();
    for (int i = 0; i < n; i++) {
        Node node = intersectedElements.item(i);
        if (node instanceof Element) {
            list.add((Element) node);
        }
    }
    return list;
}
Also used : SVGOMRect(org.apache.batik.dom.svg.SVGOMRect) SVGTSpanElement(org.w3c.dom.svg.SVGTSpanElement) SVGTextContentElement(org.w3c.dom.svg.SVGTextContentElement) SVGElement(org.w3c.dom.svg.SVGElement) Element(org.w3c.dom.Element) SVGAElement(org.w3c.dom.svg.SVGAElement) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) ArrayList(java.util.ArrayList) SVGPoint(org.w3c.dom.svg.SVGPoint)

Aggregations

ArrayList (java.util.ArrayList)1 SVGOMRect (org.apache.batik.dom.svg.SVGOMRect)1 Element (org.w3c.dom.Element)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1 SVGAElement (org.w3c.dom.svg.SVGAElement)1 SVGElement (org.w3c.dom.svg.SVGElement)1 SVGPoint (org.w3c.dom.svg.SVGPoint)1 SVGTSpanElement (org.w3c.dom.svg.SVGTSpanElement)1 SVGTextContentElement (org.w3c.dom.svg.SVGTextContentElement)1