You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Lukasz Matuszczak <l....@atrem.pl> on 2005/04/21 12:38:32 UTC
complex svg components - batik extension
Is it possible (and is it a proper way to do it?) to make such batik extension
which would generate some complex set of svg tags from my custom tag. Then I
would like to control the state of these svg tags from a Java class (perhaps
some specific kind of a graphics node).
for example i would like to generate from a tag:
<oc:component x="10" y="40" width="200" height="300"
xmlns:oc="http://mynamespace"
state="off" type="measurement" font-style="Arial">
<oc:dataSource>someSource</oc:dataSource>
</oc:component>
||
\/
<g>
<rect x="10" y="40" width="200" height="300" visible="dependant on
datasource"/>
<text font-style="Arial" x="20" y="400" font-size="50">value from
datasource</text>
<circle cx="150" cy="150" r="20" fill="dependant on datasource"
visible="dependant on datasource"/>
<g>
some complex svg content dependant on datasource
</g>
</g>
Note that several fragments (attributes, value of <text> tag, content of <g>
tag) of this document fragment are somehow dependant on Java processing. In my
current solution I'm searching for my components before building gvt tree
(nodelist = doc.getElementsByTagNameNS("http://mynamespace","component")) and
then I'm creating java objects (new MyComponent(node from nodelist)). In these
MyComponent objects I'm operating on Dom tree using update manager.
This solution has several drawbacks. Firstly it's a little complex to
synchronize processing (start and then stop it correctly). I can't update before
UpdateManager is started, and I don't want to hold references to DOM tree in
MyComponent object if the JSVGCanvas is disposed. Moreover searching for my
components (using getElementsByTagNameNS) is a bit time-consuming. Therefore
I've thought about integrate my components with batik extension mechanism.
But I don't know how to do it. AFAIK there is a one to one correspondence
between DOM and GVT nodes. I don't want also to draw my custom GraphicsNode
without using SVG tags, because the power of my components' presentation lies in
SVG.
Any suggestions?
Regards,
Lukasz Matuszczak
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: complex svg components - batik extension
Posted by Lukasz Matuszczak <l....@atrem.pl>.
----- Original Message -----
From: "Thomas DeWeese" <Th...@Kodak.com>
To: <ba...@xmlgraphics.apache.org>
Sent: Thursday, April 21, 2005 1:09 PM
Subject: Re: complex svg components - batik extension
> Hi Lukasz,
>
> This is possible, and with SVG 1.2 and the sXBL stuff that
> Cameron is working on much of this sort of processing
> will become 'integrated' into SVG. So it might be of interest
> to try and work with Cameron and the SVG 1.2 branch to see
> what can be done going forward.
>
> In the shorter term you might look at how the multiImage
> element is implemented. It does a lot of what you are
> considering. It internally builds 'image' or 'g' elements
> uses the BridgeContext & GVTBuilder to construct a multiple
> GVT trees that it passes rendering to as appropriate.
>
> It's not exactly what you are looking to do but it is close.
Thanks, Thomas, I'll look into it.
Regards,
Lukasz Matuszczak
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: complex svg components - batik extension
Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Lukasz,
This is possible, and with SVG 1.2 and the sXBL stuff that
Cameron is working on much of this sort of processing
will become 'integrated' into SVG. So it might be of interest
to try and work with Cameron and the SVG 1.2 branch to see
what can be done going forward.
In the shorter term you might look at how the multiImage
element is implemented. It does a lot of what you are
considering. It internally builds 'image' or 'g' elements
uses the BridgeContext & GVTBuilder to construct a multiple
GVT trees that it passes rendering to as appropriate.
It's not exactly what you are looking to do but it is close.
Lukasz Matuszczak wrote:
> Is it possible (and is it a proper way to do it?) to make such batik
> extension which would generate some complex set of svg tags from my
> custom tag. Then I would like to control the state of these svg tags
> from a Java class (perhaps some specific kind of a graphics node).
>
> for example i would like to generate from a tag:
>
> <oc:component x="10" y="40" width="200" height="300"
> xmlns:oc="http://mynamespace"
> state="off" type="measurement" font-style="Arial">
> <oc:dataSource>someSource</oc:dataSource>
> </oc:component>
>
> ||
> \/
>
> <g>
> <rect x="10" y="40" width="200" height="300" visible="dependant on
> datasource"/>
> <text font-style="Arial" x="20" y="400" font-size="50">value from
> datasource</text>
> <circle cx="150" cy="150" r="20" fill="dependant on datasource"
> visible="dependant on datasource"/>
> <g>
> some complex svg content dependant on datasource
> </g>
> </g>
>
> Note that several fragments (attributes, value of <text> tag, content of
> <g> tag) of this document fragment are somehow dependant on Java
> processing. In my current solution I'm searching for my components
> before building gvt tree (nodelist =
> doc.getElementsByTagNameNS("http://mynamespace","component")) and then
> I'm creating java objects (new MyComponent(node from nodelist)). In
> these MyComponent objects I'm operating on Dom tree using update manager.
> This solution has several drawbacks. Firstly it's a little complex to
> synchronize processing (start and then stop it correctly). I can't
> update before UpdateManager is started, and I don't want to hold
> references to DOM tree in MyComponent object if the JSVGCanvas is
> disposed. Moreover searching for my components (using
> getElementsByTagNameNS) is a bit time-consuming. Therefore I've thought
> about integrate my components with batik extension mechanism.
>
> But I don't know how to do it. AFAIK there is a one to one
> correspondence between DOM and GVT nodes. I don't want also to draw my
> custom GraphicsNode without using SVG tags, because the power of my
> components' presentation lies in SVG.
>
> Any suggestions?
>
> Regards,
> Lukasz Matuszczak
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org