Package org.apache.flex.forks.batik.gvt

Examples of org.apache.flex.forks.batik.gvt.GraphicsNode


        }

        public void mouseExited(GraphicsNodeMouseEvent evt) {
            Point clientXY = evt.getClientPoint();
            // Get the 'new' node for the DOM event.
            GraphicsNode node = evt.getRelatedNode();
            Element targetElement = getEventTarget(node, clientXY);
            if (lastTargetElement != null) {
                int n = 0;
                if (targetElement != null) {
                    // moving from one element to another
View Full Code Here


            }
        }

        public void mouseMoved(GraphicsNodeMouseEvent evt) {
            Point clientXY = evt.getClientPoint();
            GraphicsNode node = evt.getGraphicsNode();
            Element targetElement = getEventTarget(node, clientXY);
            Element holdLTE = lastTargetElement;
            if (holdLTE != targetElement) {
                if (holdLTE != null) {
                    int n = 0;
View Full Code Here

            mindary[i] = minD;
            maxdary[i] = maxD;
            n++;
        }

        GraphicsNode node = new MultiResGraphicsNode(e, clip, elemary,
                                                     mindary, maxdary,
                                                     ctx);
        imgNode.setImage(node);

        return imgNode;
View Full Code Here

                        m != null;
                        m = getNextSibling(m)) {
                    if (m.getNodeType() != Node.ELEMENT_NODE) {
                        continue;
                    }
                    GraphicsNode gn = builder.build(ctx, (Element) m);
                    if (gn != null) {
                        cgn2.add(gn);
                        if (isStatic) {
                            flowRegionNodes.put(m, gn);
                        }
                    }
                }

                if (!isStatic) {
                    AbstractNode an = (AbstractNode) n;
                    XBLEventSupport es =
                        (XBLEventSupport) an.initializeEventSupport();
                    es.addImplementationEventListenerNS
                        (SVG_NAMESPACE_URI, "shapechange", regionChangeListener,
                         false);
                }
            }
        }

        // build text node
        GraphicsNode tn = (GraphicsNode) cgn.get(1);
        super.buildGraphicsNode(ctx, e, tn);

        // Drop references once static build is completed.
        flowRegionNodes = null;
    }
View Full Code Here

        Rectangle2D rect = new Rectangle2D.Float(svgRect.getX(),
                                                 svgRect.getY(),
                                                 svgRect.getWidth(),
                                                 svgRect.getHeight());

        GraphicsNode svgGN = ctx.getGraphicsNode(e);
        if (svgGN == null) return ret;

        Rectangle2D svgBounds = svgGN.getSensitiveBounds();
        if (svgBounds == null)
            return ret;

        // If the svg elem doesn't intersect none of the children
        // will.
        if (!rect.intersects(svgBounds))
            return ret;

        Element base = e;
        AffineTransform ati = svgGN.getGlobalTransform();
        try {
            ati = ati.createInverse();
        } catch (NoninvertibleTransformException e) {
        }
       
        Element curr;
        Node    next = base.getFirstChild();
        while (next != null) {
            if (next instanceof Element)
                break;
            next = next.getNextSibling();
        }
        if (next == null) return ret;
        curr = (Element)next;

        Set ancestors = null;
        if (end != null) {
            ancestors = getAncestors(end, base);
            if (ancestors == null)
                end = null;
        }
        while (curr != null) {
            String nsURI = curr.getNamespaceURI();
            String tag = curr.getLocalName();
            boolean isGroup;
            isGroup = SVG_NAMESPACE_URI.equals(nsURI)
                && (SVG_G_TAG.equals(tag)
                        || SVG_SVG_TAG.equals(tag)
                        || SVG_A_TAG.equals(tag));

            GraphicsNode gn = ctx.getGraphicsNode(curr);
            if (gn == null) {
                // No graphics node but check if curr is an
                // ancestor of end.
                if ((ancestors != null) && (ancestors.contains(curr)))
                    break;
                curr = getNext(curr, base, end);
                continue;
            }
               

            AffineTransform at = gn.getGlobalTransform();
            Rectangle2D gnBounds = gn.getSensitiveBounds();
            at.preConcatenate(ati);
            if (gnBounds != null)
                gnBounds = at.createTransformedShape(gnBounds).getBounds2D();
               
            if ((gnBounds == null) ||
View Full Code Here

        List ret = new ArrayList();
        Rectangle2D rect = new Rectangle2D.Float(svgRect.getX(),
                                                 svgRect.getY(),
                                                 svgRect.getWidth(),
                                                 svgRect.getHeight());
        GraphicsNode svgGN     = ctx.getGraphicsNode(e);
        if (svgGN == null) return ret;

        Rectangle2D  svgBounds = svgGN.getSensitiveBounds();
        if (svgBounds == null)
            return ret;

        // If the svg elem doesn't at least intersect none of the
        // children will be enclosed.
        if (!rect.intersects(svgBounds))
            return ret;

        Element base = e;
        AffineTransform ati = svgGN.getGlobalTransform();
        try {
            ati = ati.createInverse();
        } catch (NoninvertibleTransformException e) {
        }
       
        Element curr;
        Node    next = base.getFirstChild();
        while (next != null) {
            if (next instanceof Element)
                break;
            next = next.getNextSibling();
        }

        if (next == null) return ret;
        curr = (Element)next;

        Set ancestors = null;
        if (end != null) {
            ancestors = getAncestors(end, base);
            if (ancestors == null)
                end = null;
        }

        while (curr != null) {
            String nsURI = curr.getNamespaceURI();
            String tag = curr.getLocalName();
            boolean isGroup;
            isGroup = SVG_NAMESPACE_URI.equals(nsURI)
                && (SVG_G_TAG.equals(tag)
                        || SVG_SVG_TAG.equals(tag)
                        || SVG_A_TAG.equals(tag));

            GraphicsNode gn = ctx.getGraphicsNode(curr);
            if (gn == null) {
                // No graphics node but check if curr is an
                // ancestor of end.
                if ((ancestors != null) && (ancestors.contains(curr)))
                    break;
                curr = getNext(curr, base, end);
                continue;
            }
               

            AffineTransform at = gn.getGlobalTransform();
            Rectangle2D gnBounds = gn.getSensitiveBounds();
            at.preConcatenate(ati);
            if (gnBounds != null)
                gnBounds = at.createTransformedShape(gnBounds).getBounds2D();

            if ((gnBounds == null) ||
View Full Code Here

        return ret;
    }

    public boolean checkIntersection (Element element, SVGRect svgRect ) {

        GraphicsNode svgGN = ctx.getGraphicsNode(e);
        if (svgGN == null) return false; // not in tree?

        Rectangle2D rect = new Rectangle2D.Float
            (svgRect.getX(),     svgRect.getY(),
             svgRect.getWidth(), svgRect.getHeight());
        AffineTransform ati = svgGN.getGlobalTransform();

        try {
            ati = ati.createInverse();
        } catch (NoninvertibleTransformException e) {  }

        SVGContext svgctx = null;
        if (element instanceof SVGOMElement) {
            svgctx  = ((SVGOMElement)element).getSVGContext();
            if ((svgctx instanceof SVGTextElementBridge) ||
                (svgctx instanceof
                 SVGTextElementBridge.AbstractTextChildSVGContext)) {
                return SVGTextElementBridge.getTextIntersection
                    (ctx, element, ati, rect, true);
            }
        }

        Rectangle2D gnBounds = null;
        GraphicsNode gn    = ctx.getGraphicsNode(element);
        if (gn != null)
            gnBounds = gn.getSensitiveBounds();

        if (gnBounds == null) return false;


        AffineTransform at = gn.getGlobalTransform();
        at.preConcatenate(ati);

        gnBounds = at.createTransformedShape(gnBounds).getBounds2D();
        if (!rect.intersects(gnBounds))
            return false;
View Full Code Here

        return false;
    }

    public boolean checkEnclosure (Element element, SVGRect svgRect ) {
        GraphicsNode gn    = ctx.getGraphicsNode(element);
        Rectangle2D gnBounds = null;
        SVGContext svgctx = null;
        if (element instanceof SVGOMElement) {
            svgctx  = ((SVGOMElement)element).getSVGContext();
            if ((svgctx instanceof SVGTextElementBridge) ||
                (svgctx instanceof
                 SVGTextElementBridge.AbstractTextChildSVGContext)) {
                gnBounds = SVGTextElementBridge.getTextBounds
                    (ctx, element, true);
                Element p = (Element)element.getParentNode();
                // Get GN for text children so we can get transform.
                while ((p != null) && (gn == null)) {
                    gn = ctx.getGraphicsNode(p);
                    p = (Element)p.getParentNode();
                }
            } else if (gn != null)
                gnBounds = gn.getSensitiveBounds();
        } else if (gn != null)
            gnBounds = gn.getSensitiveBounds();

        if (gnBounds == null) return false;

        GraphicsNode svgGN = ctx.getGraphicsNode(e);
        if (svgGN == null) return false; // not in tree?

        Rectangle2D rect = new Rectangle2D.Float
            (svgRect.getX(),     svgRect.getY(),
             svgRect.getWidth(), svgRect.getHeight());
        AffineTransform ati = svgGN.getGlobalTransform();
        try {
            ati = ati.createInverse();
        } catch (NoninvertibleTransformException e) {  }

        AffineTransform at = gn.getGlobalTransform();
View Full Code Here

     * @param ctx the bridge context to use
     * @param e the element that describes the graphics node to build
     * @return a graphics node that represents the specified element
     */
    public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) {
        GraphicsNode refNode = null;
        GVTBuilder builder = ctx.getGVTBuilder();
        selectedChild = null;
        for (Node n = e.getFirstChild(); n != null; n = n.getNextSibling()) {
            if (n.getNodeType() == Node.ELEMENT_NODE) {
                Element ref = (Element)n;
View Full Code Here

                gn.remove(0);
                disposeTree(selectedChild);
            }
            selectedChild = childElt;
            GVTBuilder builder = ctx.getGVTBuilder();
            GraphicsNode refNode = builder.build(ctx, childElt);
            if (refNode != null) {
                gn.add(refNode);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.flex.forks.batik.gvt.GraphicsNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.