From: Adam B. <ab...@o2...> - 2011-06-06 11:08:16
|
I was working on moving entire drawing to SVG (and this was one of the reasons I tried to push Batik 1.7). But recently my second child was born and there is some little chaos in my life with not much time for such tasks. I still have SVN Patch yet it is already conflicting at some places with new code. What I managed to get was to create an SVG document containing map (all the tiles, either from map or track tiles). It looked significantly better than our previous drawing mechanism. While it was much less and much simpler code. Also it scaled nicely. What the code was missing was: (1) drawing station tokens, (2) drawing train paths, (3) handling scaling and scrolling well, (4) support tile selection. First two would likely require some "hacking" as there is no easy way currently to do it in SVG Document as there is not "specification" of tracks and stations on an SVG tile. But previous code did it somehow and I guess that solution could be used with SVG Document as well until (if ever) SVG tiles will receive better description. (That is a topic interesting on its own...) I tries to handle third by using JSVGSrolledPane (or something called similarly) but didn't achieve much. Then I had to interrupt my investigations. Fourth should be easy as Batik provides some events to detect this. I expect this could be even easier then current mouse handling. Borders around selected or marked tiles could likely be achieved easily with CSS in the SVG Document. I can post that Patch if anyone is interested (but not until I'm at home) especially that I don't know whether I will find time to continue this work. Adam Badura -----Oryginalna wiadomość----- From: Erik Vos Sent: Monday, June 06, 2011 12:55 PM To: 'Development list for Rails: an 18xx game' Subject: Re: [Rails-devel] Background Maps I have found the Batik JSVGCanvas approach to be promising. The main problem is the lack of any good documentation, tutorials or how-to's on the functionality that we need, and the Javadocs aren't very helpful either. After searching during the better part of yesterday, I found some pointers on high Google page numbers that finally put me in the right direction. Some observations: - The 18EU map loads faster, though not at lightning speed. The map is big (~800K), XML parsing is notoriously slow, and I suspect initial SVG rendering also is. - The speed of tile drawing is about back to normal. - Best of all: no more crashes. That really tips the balance for me. - Zooming works, but the zoomed map and tiles do not align yet. Tiles are still drawn the old way, in a different layer, and using separate coordinates. Alignment currently is a trial-and-error exercise that apparently does not survive zooming. The obvious follow-up is to see if tile drawing can also be moved to the JSVGCanvas. I suppose this will amount to manipulating the underlying DOM. I'll probably postpone that until a later stage. My intention is to commit the new code pretty soon (using the map will remain optional). First I want to give post-zooming alignment a few more tries. I'll probably also include Bill Rosgen's suggestions to change hex highlighting. Erik. > -----Oorspronkelijk bericht----- > Van: brett lentz [mailto:bre...@gm...] > Verzonden: vrijdag 3 juni 2011 20:59 > Aan: Development list for Rails: an 18xx game > Onderwerp: Re: [Rails-devel] Background Maps > > That sounds like a very possible option. If we can let Batik handle all of > the > image processing internally, that sounds like a win to me. > > ---Brett. > > > > On Fri, Jun 3, 2011 at 11:56 AM, Erik Vos <eri...@xs...> wrote: > > This stuff is mostly new to me, but on a first look into Batik, I wonder > > if we > could use the Batik Swing interface. > > Should we change the map into a JSVGCanvas? > > > > Or two? Because, to achieve displaying the map *below* the tiles, I had > > to > insert a JLayeredPane, with the map on layer -1 (bottom) and the tiles on > layer 0 (top). Without that layered pane, it turned out the other way > around > (don't know why). > > > > Erik > > > > P.S. I changed the subject of this thread. > > > >> -----Oorspronkelijk bericht----- > >> Van: brett lentz [mailto:bre...@gm...] > >> Verzonden: vrijdag 3 juni 2011 19:28 > >> Aan: Development list for Rails: an 18xx game > >> Onderwerp: Re: [Rails-devel] 18EU: Background Map submission (revised > >> version) > >> > >> I have a feeling that old drawing code is just incredibly inefficient > >> and adding the map might tip it over into unusability. I'll blame my > >> limited understanding of AWT. It's probably time to refactor a bunch > >> of that. ;-) > >> > >> Some possible places to look for improvements: > >> > >> 1. It looks like we're still using AffineTransforms on the > >> rasterized version of the hex. (A remnant from when we were still > >> using GIF-based tiles. There is likely a way to get Batik to > >> manipulate the vector-based format prior to rasterization in a more > efficient way. > >> > >> Once we rasterize the image, we should avoid changing it. > >> > >> 2. There may be a better way to load the map than with > >> BufferedImageTranscoder. > >> > >> 3. Profiling the code will likely help quickly locate the reason > >> drawing is > slow. > >> It looks like there's some profiling plugins available for Eclipse ( > >> http://www.eclipse.org/tptp/home/downloads/ ), but I'm not sure how > >> well they work. > >> > >> Though, simply adding a few debugging statements starting at paint() > >> or > >> paintComponent() might be sufficient to see how often they're called > >> in a single rendering. It might just be a simple issue of repainting > >> the window more often than we really need to. > >> > >> > >> ---Brett. > >> > >> > >> > >> On Fri, Jun 3, 2011 at 9:02 AM, Erik Vos <eri...@xs...> wrote: > >> > OK, I have attached a patch file that includes all differences. > >> > Hope it's not > >> too big... > >> > The main part is a trimmed version of the 18EU map, with all empty > >> > borders > >> removed (by Inkscape). > >> > I did that in the hope that it would help fixing the crash problem, > >> > but it > >> didn't help at all. But in any case I think it's better to avoid > >> such empty borders. > >> > > >> > Erik. > >> > > >> >> -----Oorspronkelijk bericht----- > >> >> Van: brett lentz [mailto:bre...@gm...] > >> >> Verzonden: vrijdag 3 juni 2011 16:54 > >> >> Aan: Development list for Rails: an 18xx game > >> >> Onderwerp: Re: [Rails-devel] 18EU: Background Map submission > >> >> (revised > >> >> version) > >> >> > >> >> On Fri, Jun 3, 2011 at 5:43 AM, Erik Vos <eri...@xs...> wrote: > >> >> > I would like to give other people a chance to play with this new > >> >> > stuff, but I'm not sure if I should commit my changes to the SVN > >> >> > trunk. Perhaps we should create a branch for this experimental > >> >> > feature (but I have no clue how to do that - I've never done > >> >> branching before). > >> >> > On the other hand, I have already added a configuration property > >> >> > to completely suppress the use of SVG maps, so probably no harm > >> >> > would be done by putting this code into the trunk anyway. > >> >> > > >> >> > Suggestions? > >> >> > > >> >> > >> >> Post your implementation to the list as a set of diffs. Perhaps > >> >> just a second set of eyes can help spot the issue. > >> >> > >> >> > Erik. > >> >> > >> >> ---Brett. > >> >> > >> >> ------------------------------------------------------------------ > >> >> --- > >> >> --------- Simplify data backup and recovery for your virtual > >> >> environment with vRanger. > >> >> Installation's a snap, and flexible recovery options mean your > >> >> data is safe, secure and there when you need it. Discover what all > >> >> the > >> cheering's about. > >> >> Get your free trial download today. > >> >> http://p.sf.net/sfu/quest-dev2dev2 > >> >> _______________________________________________ > >> >> Rails-devel mailing list > >> >> Rai...@li... > >> >> https://lists.sourceforge.net/lists/listinfo/rails-devel > >> > > >> > ------------------------------------------------------------------- > >> > --- > >> > -------- Simplify data backup and recovery for your virtual > >> > environment with vRanger. > >> > Installation's a snap, and flexible recovery options mean your data > >> > is safe, secure and there when you need it. Discover what all the > >> > cheering's > >> about. > >> > Get your free trial download today. > >> > http://p.sf.net/sfu/quest-dev2dev2 > >> > _______________________________________________ > >> > Rails-devel mailing list > >> > Rai...@li... > >> > https://lists.sourceforge.net/lists/listinfo/rails-devel > >> > > >> > > >> > >> --------------------------------------------------------------------- > >> --------- Simplify data backup and recovery for your virtual > >> environment with vRanger. > >> Installation's a snap, and flexible recovery options mean your data > >> is safe, secure and there when you need it. Discover what all the > cheering's about. > >> Get your free trial download today. > >> http://p.sf.net/sfu/quest-dev2dev2 > >> _______________________________________________ > >> Rails-devel mailing list > >> Rai...@li... > >> https://lists.sourceforge.net/lists/listinfo/rails-devel > > > > > > ---------------------------------------------------------------------- > > -------- Simplify data backup and recovery for your virtual > > environment with vRanger. > > Installation's a snap, and flexible recovery options mean your data is > > safe, secure and there when you need it. Discover what all the > > cheering's > about. > > Get your free trial download today. > > http://p.sf.net/sfu/quest-dev2dev2 > > _______________________________________________ > > Rails-devel mailing list > > Rai...@li... > > https://lists.sourceforge.net/lists/listinfo/rails-devel > > > > ------------------------------------------------------------------------------ > Simplify data backup and recovery for your virtual environment with > vRanger. > Installation's a snap, and flexible recovery options mean your data is > safe, > secure and there when you need it. Discover what all the cheering's about. > Get your free trial download today. > http://p.sf.net/sfu/quest-dev2dev2 > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Discover what all the cheering's about. Get your free trial download today. http://p.sf.net/sfu/quest-dev2dev2 _______________________________________________ Rails-devel mailing list Rai...@li... https://lists.sourceforge.net/lists/listinfo/rails-devel |