I'm looking at this a bit more. Since we may be working on it at the
same time, I thought I'd provide and update.
Christopher Barker wrote:
> Tim Ansell wrote:
> When I make it that small, I do seem to get some issues with the
> "slices" lining up -- it looks like a result of rounding to integer
> pixels.
I think the issue is that the StartXY of the first slice is not the same
as the EndXY of the last slice. That should be fixable.
A few style issues (of this is going to get included in FloatCanvas,
which I'd like it to -- I'm not sure if it should be a demo or another
standard Object -- hmmm.
* you used tabs for indentation! as mixing tabs and spaces is a
serious no-no, I've followed what is now standard Python practice:
indentation is four spaces.
* I'm a strong believer in "duck typing" -- i.e., I never check the
types of inputs -- if they behave as I want, then what more do I need to
know? Also, in this construction:
if isinstance(args, dict):
ObjectList.append(ArcPoint(EndXY, StartXY, CenterXY,
**args))
elif isinstance(args, (list, tuple)):
ObjectList.append(ArcPoint(EndXY, StartXY, CenterXY,
*args))
I don't see how args could be a dict, but even if you want that
flexibility, it's better to try to use it as one, then catch the error
if it's not -- that way, someone could pass a "dict-like" object
successfully.
FloatCanvas makes strong use of numpy, which as the very handy:
N.asarray() function. What is does is try to turn the inputs in to the
kind of array you specify, that way you then know you have an array, but
the user can pass in a large number of possible inputs. If they do pass
in an array, then there is no copying done.
* You could probably use numpy for some of the other calculations --
not going to make a noticeable performance difference here, but I prefer
the syntax -- less looping, fewer errors.
more to come...
-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