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 "Lolling, Jan" <Ja...@t-systems.com> on 2003/06/05 10:18:42 UTC

AW: AW: AW: Batik and SVG for displaying multiple graphical Objec ts.. .

OK now it is clear.

BATIK is the right think to solve your task.

Than all comments from Vincent are correct and the best way to create and remove elements is manipulating the DOM in the update manager.

You can retrieve this from JSVGCanvas methode 
getUpdateManager().getUpdateRunnableQueue().invokeLater(yourDOMUpdateRunnable);

here is an code snippet---------------

                canvas.getUpdateManager().getUpdateRunnableQueue().invokeLater(new Runnable() {
                    public void run() {
                        Element rectangle = document.createElementNS(svgNS, "rect");
                        rectangle.setAttributeNS(null, "x", String.valueOf(x));
                        rectangle.setAttributeNS(null, "y", String.valueOf(y));
                        rectangle.setAttributeNS(null, "width", String.valueOf(ddx));
                        rectangle.setAttributeNS(null, "height", String.valueOf(ddy));
                        rectangle.setAttributeNS(null, "style", "fill:white; stroke:black");
                        svgRoot.appendChild(rectangle);
                    } //run
                });

---------------------------------

This is an example to create an rectangle.

Jan



-----Ursprüngliche Nachricht-----
Von: Reinhard Brandstädter [mailto:r.brandstaedter@gmx.at]
Gesendet: Donnerstag, 5. Juni 2003 00:35
An: Batik Users
Betreff: Re: AW: AW: Batik and SVG for displaying multiple graphical
Objects.. .


OK Sorry for causing this confusion. I'll try again but to do so I'll 
better describe my whole application (real stand alone application not a 
web application):

Imagine  I have a stream of Objects (not grapical Objects) let's call 
them "Events". These Events are to be represented as graphical Objects, 
let's call these graphical Objects "Representation".
So every "Event" get's assigned exactly one "Representation". I want to 
specify these "Representations" as SVG. Lets say all Events "A" should 
be displayed as a Representation "blue filled rectangle" ("BFR"), and 
all Events "B" as "red filled circles" ("RFC")

So what happens: I have a screen - call it "Monitor". The Monitor should 
display all different "Representations".
So assume I have a Event stream consisting of the Events:
A A B A B
We know As should be represented as BFRs and Bs should be displayed as 
RFCs somewhere on the Monitor for some time and then disapear again.
So let's read "A", generate a SVG "BFR" and display this graphic 
somewhere on the "Monitor", then read the next "A" generate a SVG "BFR" 
and display it somewhere else on the Monitor, read Event "B" generate 
SVG "RFC", and display it, meanwhile the Event "A" has "timed out" and 
we want to remove the Representation for it from the Monitor again...and 
so on.
While Events happen, representations are generated and displayed and 
removed again...there is a timeline that advances and the content of the 
Monitor (= different Representations = single SVG) changes when time 
advances.


Sorry for confusing you again, I should have described it like this before.
I hope it's a little bit easier to understand now.

Thanks,
Reinhard


Lolling, Jan wrote:
> I am a little bit confused...
> If you talk about SVGs - do you mean several shapes e.g or do you mean several graphics ?
> SVG-Objects is not an appropriated name for anythink. We talk about svg graphics ore elements (one svg graphic contains several elements) and one element is one shape or group.
> 
> JSVGCanvas can only display ONE graphic within several elements.
> 
> Please describe your application architecture. Do you want create a application or web application ? In the second case you do not need batik and you can deliver and manipulate your graphic an an servlet e.g.
> 
> Jan
> 
> -----Ursprüngliche Nachricht-----
> Von: Reinhard Brandstädter [mailto:r.brandstaedter@gmx.at]
> Gesendet: Mittwoch, 4. Juni 2003 17:22
> An: Batik Users
> Betreff: Re: AW: Batik and SVG for displaying multiple graphical
> Objects...
> 
> 
> Lolling, Jan wrote:
> 
>>First of all - SVG is exactly what you need and matching perfect with your request.
> 
> 
> OK that's good to know!
> 
> So to bring it to one point:
> You think it's possible to read several SVGs or create many of them and 
> then display them independently in a client application.
> I think the best description is: I want to write a live-Monitor-like 
> application (display changing graphical information during execution 
> time) where all grapical informations shown are single runtime generated 
> graphics based on SVG input.
> 
> 
> What would be the best way to display several SVG-Objects (or converted 
> to Java Swing components) in one single Java Application?
> 
> Maybe my definition is not very clear to understand, sorry for that
> 
> Reinhard
> 
> 
> 
>>point 2
>>A good method is e.g. to create the entire svg graphic at runtime from any datasource.
>>If you want to display the svg graphic in an browser you do not need batik framework.
>>I have build a web application what creates svg graphics in a servlet. These graphics is shown with the Adobe SVG plugin for IE or Mozilla.
>>If you want to build a client application than batik is needed!
>>
>>There is a mistake or misunderstanding in your point 3.
>>JSVGCanvas can only display one document in time not one object.
>>A document can containing uncounted among of objects (graphical elements).
>>The initialization time is depending from the count and complextity of elements.
>>
>>Jan
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org


-- 
Reinhard Brandstaedter   r.brandstaedter@gmx.at  GPG: 0x033B81DB
-    Student of Computer Science - J.K. University of Linz     -
-        <ICQ: 73059068>    <Mobile: +43 699 12419541>         -
-                  http://adelaide.dnsalias.net                -


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


getting Update Manager for JSVGCanvas...

Posted by Reinhard Brandstädter <r....@gmx.at>.
Jan suggested updating a SVGDocument displayed in a JSVGCanvas via the 
UpdateManager, but now I'm struggling with getting the UpdateManager for 
my canvas.

I'm new to Batik and just playing around a little bit, but the Javadoc 
isn't very helpful...

How do I create a UpdateManager so that I can use it in the way 
described by Jan below?

I tried something (useless as the UpdateManager returned is null) like this:
This test should only "move" the rectangle "myrect" accross the canvas (?)
------
svgCanvas.setSVGDocument(svgDoc);
svgCanvas.getUpdateManager(). \\
getUpdateRunnableQueue().invokeLater(new Runnable() {
   public void run() {
     int x=0, y=0;
     for (;;) {
       x = (x+1)%400;
       y = (y+1)%400;
       Element e = svgDoc.getElementById("myrect");
       e.setAttribute("x",(new Integer(x)).toString());
       e.setAttribute("y",(new Integer(y)).toString());
     }
   }
}
);
------

thx,
Reinhard

Lolling, Jan wrote:
> OK now it is clear.
> 
> BATIK is the right think to solve your task.
> 
> Than all comments from Vincent are correct and the best way to create and remove elements is manipulating the DOM in the update manager.
> 
> You can retrieve this from JSVGCanvas methode 
> getUpdateManager().getUpdateRunnableQueue().invokeLater(yourDOMUpdateRunnable);
> 
> here is an code snippet---------------
> 
>                 canvas.getUpdateManager().getUpdateRunnableQueue().invokeLater(new Runnable() {
>                     public void run() {
>                         Element rectangle = document.createElementNS(svgNS, "rect");
>                         rectangle.setAttributeNS(null, "x", String.valueOf(x));
>                         rectangle.setAttributeNS(null, "y", String.valueOf(y));
>                         rectangle.setAttributeNS(null, "width", String.valueOf(ddx));
>                         rectangle.setAttributeNS(null, "height", String.valueOf(ddy));
>                         rectangle.setAttributeNS(null, "style", "fill:white; stroke:black");
>                         svgRoot.appendChild(rectangle);
>                     } //run
>                 });
> 
> ---------------------------------


-- 
Reinhard Brandstaedter   r.brandstaedter@gmx.at  GPG: 0x033B81DB
-    Student of Computer Science - J.K. University of Linz     -
-        <ICQ: 73059068>    <Mobile: +43 699 12419541>         -
-                  http://adelaide.dnsalias.net                -


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org