Hi folks, Sorry for the slow replies, I've been offline for a bit.
Michael E Urashka wrote: > There's a scenario that I'd very much like to implement that would > require upping the polygon count to several thousand objects. How big (how many vertices?) is each individual polygon? > When I > load that many polygons things come to a crawl however. That is quite a few. > These polygons all need to be selectable by the mouse. This is an issue, as every selectable object is drawn twice - once on the screen buffer, and once in the "hit test" buffer. > Meanwhile > there is a grid of several hundred objects updating every 10th of a > second) Are these behind or in front of the polygons? there may be a way to use the foreground buffer to help with that. > I was curious if there is any easy way to increase the > floatcanvas/polygon performance? Nothing that easy, but a few ideas: Thousands of polygons is a lot -- I'm imagining that you couldn't see them in any detail when zoomed out to see them all. If you are zoomed in, then it should only draw the ones you can see -- is the performance OK then? When zoomed out, I image that the detail is lost, so you may be able to have two sets of polygons, at two different scales. Show the ones with less detail when zoomed out, and the ones with more detail when zoomed in. We'd then need to add a way to check the zoom scale in the _Draw method, and not draw when the scale was above or below a given threshold -- in fact, I thought I'd added that already but don't seem to have. If you think this is a good idea, we can work on that together. Another, more challenging option is to enhance wxPython itself. When you call DC.DrawPolygon(Points), the Point object (a numpy array) needs to be converted to a wxList of wxPoints -- this takes a bit of processing. It could be sped up considerably by taking advantage of the new numpy array protocol, which would allow the wrapper code to recognize that you've passed in an appropriate numpy array, and directly use the data pointer -- this would take a bit of C++/SWIG hacking. Before anyone does that, though, some profiling is in order -- it may well take much longer to draw the polygon that do this data converting anyway. One more thing to try: Take a look at the Polygon _Draw method (line 604 in SVN) -- it may help to do: Points = WorldToPixel(self.Points).astype(N.int32).tolist() This converts the numpy array to a list of integers, which wxPython may process a bit faster than a numpy array or floats. Anymore details you can give about your app may help prompt other ideas. -Chris NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] _______________________________________________ FloatCanvas mailing list [email protected] http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas
