Fun stuff Andrea - I notice one of the SoC students has a data caching project in mind. Did you want to put this code in an unsupported module? Jody Aside: Patrik I know that the company Andrea works for also does consulting - if you need him to actually support this experiment.
> Patrik, Maria José, > I've developed a little replacement for the memory preloading that I've > attached to this mail. > That's a caching feature source, which is probably more sophisticated > than needed, but I could not resist making it fancy. > > That feature source is a caching wrapper against a real feature source. > The first time it gets queried, it loads the query results in a spatial > index, and then uses that index for answering subsequent queries. > Each subsequent query is evaluated, is it's found to be a subset of the > current spatial cache, the cache is used, otherwise the cache is > dropped and rebuilt against the new query. > > Being a subset of the query means having the same or less attributes, > and requiring a spatial extend that's a subset of the cached one. > > The cache loads only the required attributes to avoid taking too much > room in memory. This plays well with the renderer, that asks only > for the attributes needed for display. Yet, this is at odds with > the hightlight manager used by the mapviewer, that will always ask > for all attributes. > > So, if you're using the highlight manager, better prime the cache > with Query.ALL, so that the full dataset, all attributes included, > gets sucked into memory. From that point on, you'll never hit the > disk again, since every query is a subquery of Query.ALL. > (the issue being that the renderer uses only 3 attributes, but > the hightlight manager will asks for all of them, killing the > current cache... maybe some kind of extra logic could be used to > avoid dropping the cache for queries whose bbox is very small, > and hitting the disk for those... would make sense for the > classic "what's here" query). > > Anyways, long story short, you can wrap all of you feature sources > inside this caching one, and have all layers kept in memory with > an extra speed boost thanks to the spatial index. > > I cooked the class in my spare time without much attention, it > does not have unit tests, but I hope it'll be useful for you anyways. > Let me know how it goes, in my limited tests with the MapViewer > demo variant attached both drawing and highlighting are pretty much > instant (rendering time < 0.3 seeconds). > > Cheers > Andrea > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ------------------------------------------------------------------------ > > _______________________________________________ > Geotools-gt2-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
