I verified the Element source (actually I'm adjusting a code
inherited by someone else), and it has a "use" property as
predicted. Is it possible to get it's GraphicNode?

I post here a piece of my code as example. It may be useful to
somebody (draws an accident signal).



    public void defineSymbol() {
        Element symbol = m_doc.createElementNS(STRSVGNS, "symbol");
        symbol.setAttribute("id", "MySvgElement");
        symbol.setAttributeNS(null, "viewBox", "0 0 200 200");
        m_elDefs.appendChild(symbol);

        Element element = m_doc.createElementNS(STRSVGNS, "rect");
        element.setAttributeNS(null, "height", "200");
        element.setAttributeNS(null, "width", "200");
        element.setAttributeNS(null, "style", "fill:#d40000");
        symbol.appendChild(element);

        Element elGroup = m_doc.createElementNS(STRSVGNS, "g");
        elGroup.setAttributeNS(null, "style", "fill:white");
        symbol.appendChild(elGroup);
        // Auto
        element = m_doc.createElementNS(STRSVGNS, "path");
        element.setAttributeNS(null, "d", "M 137 73 L 88 76 L 84 93 L 84 93
L 84 93 L 84 93 " +
                "L 84 93 L 88 110 L 137 114 L 188 112 L 188 93 L 188 93 " +
                "L 188 75 L 137 73 z M 139 75 L 139 80 L 124 80 L 115 76 " +
                "L 139 75 z M 141 75 L 164 76 L 157 80 L 141 80 L 141 75 z "
+
                "M 169 76 L 169 93 L 169 93 L 169 110 L 161 106 L 161 93 L
161 93 " +
                "L 161 80 L 169 76 z M 113 78 L 124 81 L 124 93 L 124 93 " +
                "L 124 106 L 113 109 L 113 93 L 113 93 L 113 78 z M 124 107
" +
                "L 139 107 L 139 112 L 115 110 L 124 107 z M 141 107 " +
                "L 157 107 L 164 111 L 141 112 L 141 107 z");
        element.setAttributeNS(null, "id", "auto");
        elGroup.appendChild(element);

        element = m_doc.createElementNS(STRSVGNS, "use"); 
<------------------- USE ELEMENT
        element.setAttributeNS("http://www.w3.org/1999/xlink";, "xlink:href",
"#auto");
        element.setAttributeNS(null, "transform", "rotate(242)
translate(-257,-90)");
        elGroup.appendChild(element);

        element = m_doc.createElementNS(STRSVGNS, "path");
        element.setAttributeNS(null, "d",
                "M 76.463263,77 L 60.523039,42 L 64.508095,40 L 76.463263,77
z " +
                "M 80.697385,75 L 74.470735,35 L 79.202989,35 L 80.697385,75
z " +
                "M 84.433375,76 L 89.912827,38 L 94.146949,38 L 84.433375,76
z " +
                "M 106.35118,122 L 135.74097,134 L 134.49564,137 L
106.35118,122 z " +
                "M 110.08717,127 L 134.49564,150 L 130.51059,152 L
110.08717,127 z " +
                "M 105.60399,129 L 122.78954,156 L 118.80448,158 L
105.60399,129 z");
        elGroup.appendChild(element);
    }

-- 
View this message in context: 
http://www.nabble.com/Dynamic-Elements-on-zoom-tp23584458p26027518.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to