|
List Info
Thread: referred element is not displayed
|
|
| referred <def> element is not
displayed |

|
2006-01-05 12:01:10 |
|
Hi all,
I’m dealing with maps which are available in SVG format.
I have to put icons onto the map in runtime. The icons are available
in separated SVG files.
My idea is that I’m loading the icons element from the
SVG file and put them into <defs> part:
<defs>
<g
id="train-1-purple">
<polygon
i:knockout="Off" fill="#CC66CC" points="0,28 26,28
40,14 26,0 0,0 "/>
<polygon
i:knockout="Off" points="4,24 24,24 34,14 24,4 4,4 "/>
</g>
</defs>
But I have problem when I use a reference of this def
element.
if I place a <use> element in the svg file, the icon will
be displayed.
<use id="T_3_0_0"
xlink:href="#train-1-purple" x="0" y="0" />
if I try to place it from code, it won’t be displayed.
Element trainImage =
canvas.getSVGDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, SVGConstants.SVG_USE_TAG);
trainImage.setAttributeNS(XMLConstants.XLINK_NAMESPACE_URI, "xlink:href", "#train-1-purple");
trainImage.setAttributeNS(null, "id", "T_3_0_0");
trainImage.setAttributeNS(null, "x", "0");
trainImage.setAttributeNS(null, "y", "0");
trainRoot.appendChild(trainImage);
Is it a bug in
Batik or do I something wrong?
Thanks,
Tamas
|
| referred <def> element is not
displayed |

|
2006-01-05 13:05:57 |
Hi Tamás,
Gorzsás Tamás <Gorzsas.Tamas evosoft.hu> wrote on
01/05/2006 07:01:10 AM:
> I’m dealing with maps which are available in SVG
format.
> I have to put icons onto the map in runtime. The icons
are available in
> separated SVG files.
[...]
> Element trainImage =
canvas.getSVGDocument().
> createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI,
SVGConstants.SVG_USE_TAG);
>
trainImage.setAttributeNS(XMLConstants.XLINK_NAMESPACE_URI,
"xlink:href",
> "#train-1-purple");
> Is it a bug in Batik or do I something wrong?
I would suspect that you have either not informed
the
Canvas that the document will be dynamic (search for
ALWAYS_DYNAMIC),
or you are not making your changes in the UpdateManager
Thread.
|
|
| referred <def> element is not
displayed |

|
2006-01-05 17:05:18 |
On Thu, 5 Jan 2006, Gorzsás Tamás wrote:
> if I place a <use> element in the svg file, the
icon will be displayed.
>
> <use id="T_3_0_0"
xlink:href="#train-1-purple" x="0"
y="0" />
>
> if I try to place it from code, it won't be displayed.
>
>
> Element trainImage =
canvas.getSVGDocument().createElementNS(
> SVGDOMImplementation.SVG_NAMESPACE_URI,
SVGConstants.SVG_USE_TAG);
>
>
trainImage.setAttributeNS(XMLConstants.XLINK_NAMESPACE_URI,
> "xlink:href",
"#train-1-purple");
I don't know if this is the problem, but the code I use to
do this passes
"href" as the attribute, rather than
"xlink:href". You're effectively
setting the namespace twice -- maybe that comes out to
"xlink link:
href"
in the DOM.
I also have
xmlns link=
"http://www.w3.org/
1999/xlink"
in the top-level <svg> -- just in case you're missing
that.
--Z
"And Aholibamah bare Jeush, and Jaalam, and Korah:
these were the borogoves..."
*
Making a saint out of Reagan is sad. Making an idol out of
Nixon ("If the
President does it then it's legal") is contemptible.
------------------------------------------------------------
---------
To unsubscribe, e-mail: batik-users-unsubscribe xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help xmlgraphics.apache.org |
|
[1-3]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|