Chris,

Besides the Bbox hit testing I have been making additional changes for 
our application in the following areas and was wondering if you or 
anyone else using FloatCanvas had some thoughts. I will be happy to 
supply any code you or others may find useful.

(1) Drawing speed for large numbers of objects - Chris, you mention in 
the FC documentation that one could utilize functions like 
dc.DrawRectangleList() which would signficantly speed up drawing large 
numbers of objects. I have utilized those functions with good success. 
Although, this requires they all be the same shape, color, etc. In my 
case that is OK since when "zoomed far out", object most details are 
indiscernible anyway. The code I wrote would not be useful for drawing 
large numbers of objects where each is unique. If draw objects are 
sub-classed from simple shapes, the change is simple and effective.

(2) "Flickering" for large numbers of objects - The FC code uses 
"NumBetweenBlits" to draw in "steps". I changed the code so that all the 
drawing is done at once but I was wondering why it was designed that way 
originally. It spaces out the drawing time but is there something I am 
missing?

(3) Updating "Dirty Objects" - I wrote an Update() function which 
redraws a single object. It is essentially a wrapper function around 
self._DrawObjects() that sends a single object. The only problem I am 
having is with dissimilar objects that overlap each other. When they are 
"updated" they will show above the other objects until a full redraw of 
the canvas is completed. This method seemed to be easier than modifying 
DrawObject to add another "dirty flag" which would get noticed during 
_DrawObjects(). While not an optimal solution, it allows a user of our 
program to select an object and have that object show that it is 
selected without having to wait to redraw the entire canvas. Again, this 
is only an issue with many thousands of objects on the screen.

(4) Pickling FC objects - This required over-writing the __getstate__ 
and __setstate__ function for each object. Since PySWIG objects cannot 
be pickled using Pickle or cPickle, I wrote some code to do this that 
may be worth sharing/discussing, but it may be a better to discuss it on 
the main wxPython board. Essentially, wxPython objects have to be 
de-constructed and re-constructed using a string and eval() or an array 
of arguments. This is necessary for cut/copy/paste and save/load 
portions of any program that needs to save or load PySWIG objects.

I will continue to share any issues I am having for the archive, but am 
now moving onto a different part of the program.

Thanks again,

-- 
Benjamin Jessup
Mechanical Engineering Consultant
ABZ, Inc.

4451 Brookfield Corporate Dr. Suite 107
Chantilly, VA 20151
Office: (703)-631-7401
Fax: (703)-631-5282
Email:[email protected]  

_______________________________________________
FloatCanvas mailing list
[email protected]
http://paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to