Hi Sergey, Please reply via the list rather than directly to me...
My response follows this copy of your message > Thanks for you reply! > > However I cannot agree with you. Below are my steps to show that shapefile > is being read on each redraw - no cached image at all. > > My code sample can be taken from here: > http://files.rsdn.ru/90653/ShapeRendererWithTools.java > > By the way it is an example how to embed JMapPane to JFrame, thus avoiding > usage of JMapFrame. Maybe it can help someone. > > Steps are as following: > 1) Download ProcessMonitor from Sysinternals: > http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx > 2) Add Filter: Path contains .shp. Such a filter will only show reads from > the shapefile. Press CTRL+X or Press Clear icon of the ProcessMonitor. All > logged events will be removed. > 3) Correct private String PATH = "D:/data/world.shp" constant at my sample, > pointing to your shp file (I tested on small point layer). > 4) Compile and launch sample. > 5) Please notice a lot of ReadFile events - your shapefile is being read by > the code. At the path column of the ProcessMonitor you will see path to your > shapefile. > 6) Goto ProcessMonitor. Press CTRL+X or Press Clear icon of the > ProcessMonitor. All logged events will be removed. > 7) Open again sample app, please notice all of read events once again. I > think this proves my theory - even simple redraw causes a lot of shapefile > read events. > > Can you please suggest me on direction how to minimize disk usage? > > Thanks, > Sergey > Hi Sergey, I can't follow your process with the profiling tool because I don't use windows, sorry. In your original post, when you say "when a redraw is necessary" I assume you mean after zooming, panning or resizing the map pane - is that right ? For zooming in or out, the map pane requests the renderer to draw the contents of the new map area into its background image which it then blits to screen. StreamingRenderer meets this request by re-reading the shapefile (hence the term _streaming_ renderer). If you want to avoid that I guess the options would be to initially read some or all of the shapefile contents into memory first, which you could either do by creating an in-memory feature collection and then basing your MapLayer on that, or write a sub-class of StreamingRenderer that has the ability to cache features. For resizing the map pane it is the same story as for zooming since the display scale (world to screen transform) has changed. For panning, it would actually be possible to make JMapPane more efficient. At the moment it uses its cached base image while you are panning, but when you release the mouse it then asks the renderer to redraw the whole display area. It would be better to take those parts of the cached image that are still within the display area and only ask the renderer to repaint the remainder. I'll create a Jira issue for this improvement. I hope that helps. Michael ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
