David Poundall wrote:
> I tried ...
> dc.DrawPolygon(Canvas.WorldToPixel(BB.reshape((4,2))))
> 
> but received ...
> 'total size of new array must be unchanged'

oops, you're right -- I didn't think carefully. A BBox object has two 
points --lower left and upper right. you're trying to get the four 
corners of the box from that. There's probably a slicker numpy-y way to 
do that, but what you've got is fine -- though wy use a rectangle, 
rather than four points?

> Wx.XOR of worked OK but only when I coded 
> 
> obj.CalcBoundingBox()
> before I used the internal class variable like this ...
> 
> BB = obj.BoundingBox  
> 
> Would you consider returning the BoundingBox variable so that we could use
> it like this ...
> 
> BB = obj.CalcBoundingBox()

Sure, it could do that -- I don't see any harm. However, there are a 
bunch of different implementations of CalcBoundingBox(), so it would 
take a bit of work -- patches accepted!

> It took me a while to determine that Bounding Box was only updated when its
> calculating routine was being called.

Right -- I've tried to make it so all the methods that might change the 
BoundingBox call CalcBoundingBox.

This brings up a point about the idea of Properties object that stores 
all the properties. Some of the properties, like, say, the Diameter of a 
Circle, require that something be done when it is changed -- in this 
case, re-calculate the bounding box. Making a Simple dict doesn't allow 
for that. I think the traits package might.

Another option is to actually keep it the way it is, but have 
GetProperties() and SetProperties() methods that returns or takes a dict 
of all the properties a given object may have. Those methods would then 
read what was there, or update what needed to be updated. this could be 
pretty handy, as you could pass in a dict with just the properties you 
want to adjust in it, like so:

Object.SetProperties({FillColor: "Red".
                       LineStyle: "Solid"}
                      )

In fact, you could make a Properties attributes a python property, so 
that you could use it like:

Object.Properties = MyPropertiesDict
APropertiesDict = Object.Properties

But the getters and setters would get called under the covers.

All this would require is a little work in the DrawObject Base class -- 
it already has dummy setter methods for all the various properties.

By the way, if we're going to be refactoring the DrawObjects, this might 
be a good time to put all the DrawObjects in their own module -- the 
FloatCanvas module is getting pretty big!

-Chris




-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
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

Reply via email to