Package com.kitfox.svg.xml

Examples of com.kitfox.svg.xml.StyleAttribute


    {
//        if (trackManager.getNumTracks() == 0) return false;
        boolean changeState = super.updateTime(curTime);

        //Get current values for parameters
        StyleAttribute sty = new StyleAttribute();
        boolean shapeChange = false;

        if (getPres(sty.setName("x")))
        {
            float newVal = sty.getFloatValueWithUnits();
            if (newVal != x)
            {
                x = newVal;
                shapeChange = true;
            }
        }

        if (getPres(sty.setName("y")))
        {
            float newVal = sty.getFloatValueWithUnits();
            if (newVal != y)
            {
                y = newVal;
                shapeChange = true;
            }
        }

        if (getPres(sty.setName("width")))
        {
            float newVal = sty.getFloatValueWithUnits();
            if (newVal != width)
            {
                width = newVal;
                shapeChange = true;
            }
        }

        if (getPres(sty.setName("height")))
        {
            float newVal = sty.getFloatValueWithUnits();
            if (newVal != height)
            {
                height = newVal;
                shapeChange = true;
            }
        }

        try
        {
            if (getPres(sty.setName("xlink:href")))
            {
                URI src = sty.getURIValue(getXMLBase());

                URL newVal;
                if ("data".equals(src.getScheme()))
                {
                    newVal = new URL(null, src.toASCIIString(), new Handler());
                } else
                {
                    newVal = src.toURL();
                }

                if (!newVal.equals(imageSrc))
                {
                    imageSrc = newVal;
                    shapeChange = true;
                }
            }
        } catch (IllegalArgumentException ie)
        {
            Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
                "Image provided with illegal value for href: \""
                + sty.getStringValue() + '"', ie);
        } catch (Exception e)
        {
            Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
                "Could not parse xlink:href", e);
        }
View Full Code Here


    protected void build() throws SVGException
    {
        super.build();

        StyleAttribute sty = new StyleAttribute();

        if (getPres(sty.setName("x")))
        {
            x = sty.getFloatValueWithUnits();
        }

        if (getPres(sty.setName("y")))
        {
            y = sty.getFloatValueWithUnits();
        }

        if (getPres(sty.setName("width")))
        {
            width = sty.getFloatValueWithUnits();
        }

        if (getPres(sty.setName("height")))
        {
            height = sty.getFloatValueWithUnits();
        }

        if (getPres(sty.setName("xlink:href")))
        {
            URI src = sty.getURIValue(getXMLBase());
            href = src;
//            href = diagram.getUniverse().getElement(src);
        }

        //Determine use offset/scale
View Full Code Here

    {
//        if (trackManager.getNumTracks() == 0) return false;
        boolean changeState = super.updateTime(curTime);

        //Get current values for parameters
        StyleAttribute sty = new StyleAttribute();
        boolean shapeChange = false;

        if (getPres(sty.setName("x")))
        {
            float newVal = sty.getFloatValueWithUnits();
            if (newVal != x)
            {
                x = newVal;
                shapeChange = true;
            }
        }

        if (getPres(sty.setName("y")))
        {
            float newVal = sty.getFloatValueWithUnits();
            if (newVal != y)
            {
                y = newVal;
                shapeChange = true;
            }
        }

        if (getPres(sty.setName("width")))
        {
            float newVal = sty.getFloatValueWithUnits();
            if (newVal != width)
            {
                width = newVal;
                shapeChange = true;
            }
        }

        if (getPres(sty.setName("height")))
        {
            float newVal = sty.getFloatValueWithUnits();
            if (newVal != height)
            {
                height = newVal;
                shapeChange = true;
            }
        }

        if (getPres(sty.setName("xlink:href")))
        {
            URI src = sty.getURIValue(getXMLBase());
//            SVGElement newVal = diagram.getUniverse().getElement(src);
            if (!src.equals(href))
            {
                href = src;
                shapeChange = true;
View Full Code Here

    protected void build() throws SVGException
    {
        super.build();

        StyleAttribute sty = new StyleAttribute();

        if (getPres(sty.setName("unicode")))
        {
            unicode = sty.getStringValue();
        }
    }
View Full Code Here

    protected void build() throws SVGException
    {
        super.build();

        StyleAttribute sty = new StyleAttribute();

        clipPathUnits = (getPres(sty.setName("clipPathUnits"))
            && sty.getStringValue().equals("objectBoundingBox"))
            ? CP_OBJECT_BOUNDING_BOX
            : CP_USER_SPACE_ON_USE;
    }
View Full Code Here

     * update
     */
    public boolean updateTime(double curTime) throws SVGException
    {
        //Get current values for parameters
        StyleAttribute sty = new StyleAttribute();
        boolean shapeChange = false;


        if (getPres(sty.setName("clipPathUnits")))
        {
            String newUnitsStrn = sty.getStringValue();
            int newUnits = newUnitsStrn.equals("objectBoundingBox")
                ? CP_OBJECT_BOUNDING_BOX
                : CP_USER_SPACE_ON_USE;

            if (newUnits != clipPathUnits)
View Full Code Here

   
    public void build() throws SVGException
    {
        super.build();
       
        StyleAttribute sty = new StyleAttribute();
       
        if (getPres(sty.setName("x")))
        {
            x = sty.getNumberWithUnits();
        }
       
        if (getPres(sty.setName("y")))
        {
            y = sty.getNumberWithUnits();
        }
       
        if (getPres(sty.setName("width")))
        {
            width = sty.getNumberWithUnits();
        }
       
        if (getPres(sty.setName("height")))
        {
            height = sty.getNumberWithUnits();
        }
       
        if (getPres(sty.setName("viewBox")))
        {
            float[] coords = sty.getFloatList();
            viewBox = new Rectangle2D.Float(coords[0], coords[1], coords[2], coords[3]);
        }
       
        if (getPres(sty.setName("preserveAspectRatio")))
        {
            String preserve = sty.getStringValue();
           
            if (contains(preserve, "none")) { parAlignX = PA_X_NONE; parAlignY = PA_Y_NONE; }
            else if (contains(preserve, "xMinYMin")) { parAlignX = PA_X_MIN; parAlignY = PA_Y_MIN; }
            else if (contains(preserve, "xMidYMin")) { parAlignX = PA_X_MID; parAlignY = PA_Y_MIN; }
            else if (contains(preserve, "xMaxYMin")) { parAlignX = PA_X_MAX; parAlignY = PA_Y_MIN; }
View Full Code Here

    protected void build() throws SVGException
    {
        super.build();

        StyleAttribute sty = new StyleAttribute();

        //Load style string
        String href = null;
        if (getPres(sty.setName("xlink:href")))
        {
            href = sty.getStringValue();
        }
        //String href = attrs.getValue("xlink:href");
        //If we have a link to another pattern, initialize ourselves with it's values
        if (href != null)
        {
//System.err.println("Gradient.loaderStartElement() href '" + href + "'");
            try
            {
                URI src = getXMLBase().resolve(href);
                PatternSVG patSrc = (PatternSVG) diagram.getUniverse().getElement(src);

                gradientUnits = patSrc.gradientUnits;
                x = patSrc.x;
                y = patSrc.y;
                width = patSrc.width;
                height = patSrc.height;
                viewBox = patSrc.viewBox;
                patternXform.setTransform(patSrc.patternXform);
                children.addAll(patSrc.children);
            } catch (Exception e)
            {
                Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
                    "Could not parse xlink:href", e);
            }
        }

        String gradientUnits = "";
        if (getPres(sty.setName("gradientUnits")))
        {
            gradientUnits = sty.getStringValue().toLowerCase();
        }
        if (gradientUnits.equals("userspaceonuse"))
        {
            this.gradientUnits = GU_USER_SPACE_ON_USE;
        } else
        {
            this.gradientUnits = GU_OBJECT_BOUNDING_BOX;
        }

        String patternTransform = "";
        if (getPres(sty.setName("patternTransform")))
        {
            patternTransform = sty.getStringValue();
        }
        patternXform = parseTransform(patternTransform);


        if (getPres(sty.setName("x")))
        {
            x = sty.getFloatValueWithUnits();
        }

        if (getPres(sty.setName("y")))
        {
            y = sty.getFloatValueWithUnits();
        }

        if (getPres(sty.setName("width")))
        {
            width = sty.getFloatValueWithUnits();
        }

        if (getPres(sty.setName("height")))
        {
            height = sty.getFloatValueWithUnits();
        }

        if (getPres(sty.setName("viewBox")))
        {
            float[] dim = sty.getFloatList();
            viewBox = new Rectangle2D.Float(dim[0], dim[1], dim[2], dim[3]);
        }

        preparePattern();
    }
View Full Code Here

            {
                continue;
            }
            String value = attrs.getValue(i);

            presAttribs.put(name, new StyleAttribute(name, value));
        }
    }
View Full Code Here

     * Called by internal processes to rebuild the geometry of this node from
     * it's presentation attributes, style attributes and animated tracks.
     */
    protected void build() throws SVGException
    {
        StyleAttribute sty = new StyleAttribute();

        if (getPres(sty.setName("id")))
        {
            String newId = sty.getStringValue();
            if (!newId.equals(id))
            {
                diagram.removeElement(id);
                id = newId;
                diagram.setElement(this.id, this);
            }
        }
        if (getPres(sty.setName("class")))
        {
            cssClass = sty.getStringValue();
        }
        if (getPres(sty.setName("xml:base")))
        {
            xmlBase = sty.getURIValue();
        }

        //Build children
        for (int i = 0; i < children.size(); ++i)
        {
View Full Code Here

TOP

Related Classes of com.kitfox.svg.xml.StyleAttribute

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.