Sam Bartels wrote:
> Firstly I want to say thanks for Chris and all the people involved in 
> the FloatCanvas project.  I've found it really useful for my research.

You're quite welcome.

First, I'd like to hear more about your project -- I've been meaning to 
integrate FloatCanvas with GDAL/OGR as well -- I'd love to see what 
you've done.

> Now I want 
> to customise the zoom function so it zooms to a user-defined bounding 
> box automatically. 

That should be doable.

> I create the bounding box with
>     self.bounding_box = BBox.asBBox([[min_x,min_y],[max_x,max_y]])
> and then use that with the OGR spatial filter to get the features I want.
> 
> When it comes to drawing the features, I used to do a ZoomToFit after 
> each draw.

Maybe this is what you meant, but you'd want to do a ZoomToFit after 
adding or removing an Object, then call Draw(). But that's not what you 
want anyway...

> I have changed it to a 'canvas'.ZoomToBB( 
> self.bounding_box), but I get the following error
>     
> File 
> "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/lib/floatcanvas/FloatCanvas.py",
>  
> line 2706, in ZoomToBB
>     self.ViewPortCenter = N.array (((BoundingBox[0,0]+BoundingBox[1,0])/2,
> AttributeError: MapCanvas instance has no attribute '__getitem__'
> 
> where MapCanvas is the python class I've written.  Has anyone come 
> across this before? 

nope.

> I can't figure out why the attribute '__getitem__'  is expected.

neither can I, but a guess is that you've somehow passed in a MapCanvas 
instance where you meant to pass in a BoundingBox.

Try putting a print in before line 2706:

print BoundingBox

and see what it is.

-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