ROY ZINN wrote:
> 1. I understand that (0,0) is now the "top left" of the graphic part, 
> but, it is still not at the top most (Y coordinates) of the frame. i 
> mean that the chart is not "attached" right below the toolbar, but 2 
> units below it (the unit displayed on the status bar).

Here is the key to what FloatCanvas is all about: It is designed to be
scalable graphics, so that the user can easily zoom in and out, move
about the image, etc.

So a given coordinate is not mapped to a specific location in the window
-- it can move around. In the example code I sent, I called
FloatCanvas.ZoomToBB(), which zooms and pans the canvas so the every
object can be seen in the window (the "bounding box" is the rectangle
that encompasses all the objects).

So the question is: how can you make it work more like what you need?

ZoomToBB() takes a bounding box as an argument, so you can zoom it
however you want. You can also set a MinScale and a MaxScale so that it
will only zoom in or out a certain amount. If we set both MinScale and
MaxScale to the same number, then it won't zoom.

However, I'm seeing an issue here. FloatCanvas does its zooming, etc,
based on the center of the Window -- so when you re-size the window, it
keeps the center of what you were viewing in the center of the window.
That's not what you want, however, you want the upper left corner to be
fixed, and there is no way to do that right now.

It should be possible to adapt it, but it's going to take a bit of 
thought. I think we could add a "move this world point to this pixel 
location at this scale" method, which in this case, would be:

Canvas.MoveTo((0,0), (0,0), scale=28)

sorry I don't have the time to write that today....

> 2. When i stretch the frame (resize it), i would like the graphic to 
> stretch with it as well...

You'll have to catch the EVT_SIZE, and re-compute your layout.

> 3. I tried to change the distance between lines to 2 units 
> (self.SpaceWidth = 1 -> self.SpaceWidth = 2), in that case, it looks as 
> if the whole graphic "shrinks". I want a bigger distance between two 
> lines, but, keep the proportion.

remember this is scalable graphics, it looked like it shrank because it 
fit the whole thing into the window.

> 1. The list on the left (labels) can be very long (about 200 events), 
> so, in  my application now, there is a scroll bar, keeping always the 
> same number of events in the frame.
>  
> 2. The same applies to the number of "frames". there can be hundreds of 
> them, and i need to have the ability to scroll horizontally between 
> frames. In this case i have ZoomIn and ZoomOut buttons which changes the 
> number of frames i can see without scrolling (in the chart example, i 
> see two "frames" and i would like to scale the graphic area to view 4 
> "frames"...)

you can use the built-in zooming and panning to do this, though you may 
want to use scrollbars instead. A number of folks have asked for that, 
but I don't know if anyone's written that yet -- it wouldn't be hard to 
do, though. You'd want to write something like NavCanvas, but with 
scrollbars, and catch the scrollbar events and call Canvas.MoveImage 
when the scrolling happens.

> 3. For future use, i wonder if it's possible to stand on one of the 
> labels (i know that there is the clickable option and i saw in the 
> examples that it's possible to delete polygons etc) and to delete this 
> whole event (for example, remove the "Set RX Rf" event for the canvas). 
> after the deletion there shouldn't be space or blank, i need the rows to 
> "re-fit"

yup -- you'll want have a data structure that holds all your events, and 
when one is selected, you remove it form your data structure, and 
re-build the canvas from that updated structure.

. I hope i'm not asking too much,
> I would really want to do this with python (and Float Canvas),

Python and wxPython certainly. As for FloatCanvas, this isn't exactly 
the kind of thing it's designed for, but it's close, so I think you can 
make it work. the other option is to not use floatcanvas, but rather 
draw everything yourself with wx.DCs and/or wx.GraphicsContext, in 
native pixel coords. If you put it all on a wx.ScrolledWindow, it should 
be doable.

Note to Matthias (if you're reading this):

I've had this kind of request before. While FloatCanvas is really 
designed for scalable zoomable drawing, it should be easy to do this 
kind of thing, too. We might want to keep that in mind as we re-factor.

-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