Astan Chee wrote:
> Firstly, thank you very much for helping me so far and I apologize for 
> emailing you directly. I tried to mail both floatcanvas and wxpython 
> mailing list, but they both seem to reject my mail. Im not sure why.

odd - your message got to both on the 12th. Are you sending from the 
same address as you did then?

Anyway, I'm cc-ing this to the floatcanvas list, so it will be in the 
archives.

> Im trying to zoom into a bounding box that is rather irregular or not 
> square. The Box has a width of 100 units but height of 1000. When I 
> create a BBox like this:
> 
> boxed = BBox.BBox(((1, 2738),(100, 3905)))

that works like you'd expect:

 >>> boxed = BBox.BBox(((1, 2738),(100, 3905)))
 >>> boxed.Width
99.0
 >>> boxed.Height
1167.0


> But the zoom seems to be 1000 x 1000, or the width isnt 100 units but more.

However, when you do ZoomToBB, FloatCanvas adjusts the zoom to fit the 
entire bounding box in the window -- it doesn't adjust the relative 
scaling in the x and y directions.

At this point, FloatCanvas.Scale is a scalar -- the saem value in teh x 
and y directions.

If you want x and y scaled differently, you can do that with a 
projection. See the ScaleDemo.py example.

The idea is this (though it needs a bit of cleaning up):

There are a number of coordinate systems used in FloatCanvas:

1) world coords -- this is the "natural" system for your data, etc.

2) projected coords -- this is world coords after a projection of some 
sort has been applied. once projected, coords are always cartesian, y-up 
and same the scale in x and y

3) pixel coords -- this is what is actually drawn to the screen, you get 
these by scaling projected coords, and shifting zero to the origin of 
the Window. It might be better to allow the scaling to be different in X 
and Y, but I'm not so sure about that - that may be better handled by a 
projection. In any case, a projection is the only way to do it now.

NOTE:
    The current system only allows linear projections -- this was to 
maximize performance, but I think it was a mistake. I'd like to 
re-factor that some day (soon?). Note that FC2 supports more flexible 
projections and scaling, including a generic affine transform on the 
canvas, or on individual object. It's not fully functional yet 
(particularly on GTK), but if one needs that flexibility, yo may be 
better off learning FC2 and even contributing a bit to get it fully 
functional.

> Im actually attempting a plot and I was wondering if the bounding box 
> will let me stretch the x-values horizontally to scale. If it doesn't, 
> I'd scale them myself.

pre-scaling your coordinates is another option, but I understand what 
you want to do a siple projection function will work fine, and it should 
be easier.

-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