Examples of SVGRect


Examples of org.w3c.dom.svg.SVGRect

     * To implement {@link
     * org.w3c.dom.svg.SVGLocatable#getBBox()}.
     */
    public static SVGRect getBBox(Element elt) {
        final SVGOMElement svgelt = (SVGOMElement)elt;
        return new SVGRect() {
                public float getX() {
                    return (float)svgelt.getSVGContext().getBBox().getX();
                }
                public void setX(float x) throws DOMException {
                    throw svgelt.createDOMException
View Full Code Here

Examples of org.w3c.dom.svg.SVGRect

        if (!((SVGOMAnimatedRect) aViewBox).isSpecified()) {
            // no viewBox specified
            return new AffineTransform();
        }
        SVGRect viewBox = aViewBox.getAnimVal();
        float[] vb = new float[] { viewBox.getX(), viewBox.getY(),
                                   viewBox.getWidth(), viewBox.getHeight() };

        return getPreserveAspectRatioTransform(e, vb, w, h, aPAR, ctx);
    }
View Full Code Here

Examples of org.w3c.dom.svg.SVGRect

    /**
     * Returns the base value of the attribute as an {@link AnimatableValue}.
     */
    public AnimatableValue getUnderlyingValue(AnimationTarget target) {
        SVGRect r = getBaseVal();
        return new AnimatableRectValue
            (target, r.getX(), r.getY(), r.getWidth(), r.getHeight());
    }
View Full Code Here

Examples of org.w3c.dom.svg.SVGRect

            if (r != null) {
                cgn.setBackgroundEnable(r);
            }

            if (vb.isSpecified()) {
                SVGRect vbr = vb.getAnimVal();
                actualWidth = vbr.getWidth();
                actualHeight = vbr.getHeight();
            }
            ctx.openViewport
                (e, new SVGSVGElementViewport(actualWidth,
                                              actualHeight));
            return cgn;
View Full Code Here

Examples of org.w3c.dom.svg.SVGRect

            outlineElem.setAttribute("stroke-opacity", String.valueOf(outlineColor.getAlpha() / 255f));
            outlineElem.appendChild(labelTextOutline);
            target.getTopElement(SVGTarget.TOP_NODE_LABELS_OUTLINE).appendChild(outlineElem);

            //Trick to center text vertically on node:
            SVGRect rect = ((SVGLocatable) outlineElem).getBBox();
            outlineElem.setAttribute("y", String.valueOf(y + rect.getHeight() / 4f));
        }

        Element labelElem = target.createElement("text");
        labelElem.setAttribute("class", node.getId().toString());
        labelElem.setAttribute("x", String.valueOf(x));
        labelElem.setAttribute("y", String.valueOf(y));
        labelElem.setAttribute("style", "text-anchor: middle; dominant-baseline: central;");
        labelElem.setAttribute("fill", target.toHexString(color));
        labelElem.setAttribute("font-family", font.getFamily());
        labelElem.setAttribute("font-size", String.valueOf(fontSize));
        labelElem.appendChild(labelText);
        target.getTopElement(SVGTarget.TOP_NODE_LABELS).appendChild(labelElem);

        //Trick to center text vertically on node:
        SVGRect rect = ((SVGLocatable) labelElem).getBBox();
        labelElem.setAttribute("y", String.valueOf(y + rect.getHeight() / 4f));

        //Box
        if (showBox) {
            rect = ((SVGLocatable) labelElem).getBBox();
            Element boxElem = target.createElement("rect");
            boxElem.setAttribute("x", Float.toString(rect.getX() - outlineSize / 2f));
            boxElem.setAttribute("y", Float.toString(rect.getY() - outlineSize / 2f));
            boxElem.setAttribute("width", Float.toString(rect.getWidth() + outlineSize));
            boxElem.setAttribute("height", Float.toString(rect.getHeight() + outlineSize));
            boxElem.setAttribute("fill", target.toHexString(boxColor));
            boxElem.setAttribute("opacity", String.valueOf(boxColor.getAlpha() / 255f));
            target.getTopElement(SVGTarget.TOP_NODE_LABELS).insertBefore(boxElem, labelElem);
        }
    }
View Full Code Here

Examples of org.w3c.dom.svg.SVGRect

        // If a shape is selected then update the display.
        final SVGLocatableElement selected = findFirstSelectedShape();

        if (selected != null) {
            // Get the bounding box of selected object
            final SVGRect rect = selected.getBBox();

            // Update the display for the selected shape.
            updateDisplay(true, selected.getTrait("id"), rect);

            // Updated the bounding box for the selected shape.
View Full Code Here

Examples of org.w3c.dom.svg.SVGRect

     *         found.
     */
    private SVGLocatableElement findFirstSelectedShape() {
        // Scroll through shapes, determine if cursor point
        // is within shape's bounding box, and update.
        SVGRect box;

        for (int i = 0; i < _selectableShapes.size(); i++) {
            final SVGLocatableElement element =
                    (SVGLocatableElement) _selectableShapes.elementAt(i);
            box = element.getBBox();

            // Do a bounding box to point test.
            if (_cursorX >= box.getX()
                    && _cursorX <= box.getX() + box.getWidth()
                    && _cursorY >= box.getY()
                    && _cursorY <= box.getY() + box.getHeight()) {
                return element;
            }
        }
        return null;
    }
View Full Code Here

Examples of org.w3c.flex.forks.dom.svg.SVGRect

        final SVGOMElement svgelt = (SVGOMElement)elt;
        SVGContext svgctx = svgelt.getSVGContext();
        if (svgctx == null) return null;
        if (svgctx.getBBox() == null) return null;

        return new SVGRect() {
                public float getX() {
                    return (float)svgelt.getSVGContext().getBBox().getX();
                }
                public void setX(float x) throws DOMException {
                    throw svgelt.createDOMException
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.