xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "G. Wade Johnson" <wade.john...@abbnm.com>
Subject Re: Dynamic data representation with Batik
Date Tue, 05 Aug 2003 13:09:28 GMT
Building layers using either the <g/> or <svg/> tags is fairly easy. The
two handle positioning differently so you'll want to experiment with
them a bit to decide which works best for you.

I've built a system that dynamically updates elements on a display and
uses layers which may be hidden. In my case, the "effects" that are
applied to elements are not on separate layers, but other than that
the ideas are similar.

You can programmatically change attributes of elements on the screen to
change their color. I currently change the "fill" and "stroke"
attributes but you can change the "style" attribute if you prefer.

I've changed attributes on dozens to hundreds of elements at one time,
and the redraw was almost instaneous. (Tested on both 350MHz machine
and 2.4GHz machine.) It is obviously possible to generate SVG documents
that take much longer to update.

In general, I guess I'm saying that what you are asking for is quite
possible using Batik. Whether or not it works in your case depends
on specifics that you will need to evaluate.

G. Wade

Stefán Freyr Stefánsson wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hello.
> 
> I have a bit of a dilemma here and I'm hoping that someone on this list can
> help me.
> 
> The problem that I'm facing is that I need to create an application that
> displays the results of a vote. The vote is performed in a room that has a
> fixed seating arrangement and the application will display a floor plan.  The
> application will display the chairs in different colors depending on the vote
> that was cast from that chair.  The voting system is a third party system
> that we'll be able to poll and "ask" for the vote for a specific chair (each
> chair has a unique integer ID) and we might even be able to later set up some
> sort of an event mechanism that will allow the voting status to be pushed to
> our application (but that's another story).
> 
> An SVG picture is being created for us where each chair will be a single SVG
> element.  As I understand we should be able to add our own attributes to an
> element such as the aforementioned ID of each chair. It could look something
> like this:
> 
> <svg>
>   <defs>
>     <g id="chair"....
>   </defs>
> 
>   <use xlink:href="#chair" x="10" y="10" althingi:chair-id="1"/>
>   <use xlink:href="#chair" x="20" y="20" althingi:chair-id="2"/>
>   ...
> </svg>
> 
> So, what I'll have to do is create something that will poll the voting status
> from the voting system and then in some way create a "layer" on top of the
> floor plan image where the appearance of each "chair" is modified according
> to the voting status on that chair ID.
> 
> We're using Java technology for this application and we've decided to use
> Batik (unless anyone here objects?).  But the problem is that we really
> haven't got much of an idea on what exactly we can do with it to get the
> above behavior.
> 
> I've read a bit about Batik but it's a very complicated system and it seems to
> be hard to just dive into.  Therefore I decided to send this email to the
> list hoping that some kind-hearted genius out there could guide us in the
> right direction.
> 
> So here are some questions/ideas that I would like to get your opinions on:
> 
> 1) What would be the best way for us to obtain the previously mentioned
> "layer" effect?  As I said the voting status would be displayed in a "layer"
> that should be possible to "hide".  Other relevant information such as the
> name of the person sitting in that chair, the party he/she is affiliated with
> and so on would be examples of other "layers".
> This might be an "SVG specific" question but I have a feeling that using a
> "programmatical approach" would be better suited.  I've seen that the <g>
> element is sometimes used to represent layers so I guess it should be
> possible to add such an element to the document in some way but I would much
> rather like to modify the image in memory than on file.  By that I mean that
> Batik will read the floor plan from the SVG document that we have but that
> should be the end of that.  The voting status and any other information
> (persons name, party affiliation and so on) should be programmatically added
> to the memory representation of the document.  I hope I'm making myself at
> least vaguely understandable here.
> 
> 2) My next question depends a bit on the answer of the first but that is how
> it's best to manipulate data in SVG documents in Batik.  This would include
> such things as coloring one of the chairs green to signify a "yes" vote.  I
> could imagine a solution that would involve polling the voting status and
> generating a whole new SVG document and re-rendering the whole floor plan in
> the client would solve my problem but that would most definately be very slow
> and unefficient.  So if it's possible to make each "layer" a seperate SVG
> document or some sort a descriptor file that would be better than
> re-generating the whole floor plan all the time.  But the image itself would
> probably still have to be re-rendered which might not be very efficient. So
> is there any way to update an SVG document in batik (for example to make one
> of the "chairs" green) and only re-rendering the part of the image that was
> modified to save processing?
> 
> In general I'd like to hear any and all comments on what you gurus out there
> feel would be the best way to solve my problem.  If you know of anything
> similar out there that I could use as a reference (by this I mean solutions
> that use Batik... I know of the Adoby examples already) that would be most
> appreciated as would any reference to reading material related to what I have
> to do.
> 
> - --
> Kind regards, Stefan
> 
> "XML is a giant step in no direction at all" (Erik Naggum)
> "XML is a giant step in whichever direction you want it to be" (Andrew Hardie)
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.2 (GNU/Linux)
> 
> iQEVAwUBPy+I1r0ge6mq4AL2AQLHVgf7Bcu/uGmprSwCnGzvba5IB6os0vhssx8t
> mcS9ym6/VSawiMKPrsyAgE9MbIeGojT0goFO+fQ8OlW/qdY146gUEA5iERiUBu+m
> BPp9O9R8HSkd2x14h7IY7BKjiDLygToKcY+Cyg4HE1Zx+h7k+ZtRS4cffuf09j+j
> tc1u7Jn+CUIZTRZiO94tM2lgKNsSdsLy8VIWnkGw3FEqnQY1DfcQ4fBgHY499M9j
> xjeMukc64xBOkodfhJmWzW9Ihg/6jVc3I0El5GAufHS0svM5Nf7LibYjIVxKwcEh
> Utt6AzJqTSVoP/yNHR9iy2hZLYhN2dlXfjAj3EWGwqik+qxO4Y4DwQ==
> =rd3P
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message