Hey Peter,

thanks for you interest. FloatCanvas2 is still in its very early stages,  
so except the demo and the doc strings there's no api documentation right  
now.

Am 01.09.2008, 12:20 Uhr, schrieb Peter Damoc <[EMAIL PROTECTED]>:

> Initial thoughts:
>
> I need to create a system of layers that are displayed conditionally.
> Drawing of each layer should be handled in each layer's "render" method.
>
> Now, the first thing I notice is that I don't seam to have direct access  
> to
> drawing and going the
>
> self.fc.create( 'Circle', 50, parent = self.renderer, name = 'r%d' % 1,  
> pos
> = (0, 0), look = fc.SolidColourLook( line_colour = 'blue', fill_colour =
> (255,0,0,128) )  )
>
> route... seams like a recipe for spaghetti.

Can you detail a bit what you want to draw? Do you want to draw circles,  
polygons, lines, all of them? How many objects are there going to be? Do  
you need the ability to save the drawing, do you want to export to svg?  
Why do you want to use the GC directly?
FloatCanvas2 is strictly divided into a model and a view part. That's why  
you feed your data like fc.create( 'Circle', ... ) to FloatCanvas. Now  
there are various points where you can hook into to customize your  
drawing. It is possible to create custom views where you can put your  
layer "render" method into and which uses the GC directly. If you do this,  
you'll lose the ability to export to svg though. You can also create a  
custom node directly, without having to use a view at all.
To give you a conclusive answer how to customize the drawing, I need to  
know the answers to the questions above. I am also thinking about doing a  
generic Path primitive, so you can do arbitrary GC drawing without having  
to use the GC directly, this might be useful in your case, too.

> The second thing is the coordinate system. Can this be changed to  
> something
> like "upper left is (0,0)"? Can I zoom-in using this kind of coordinates
> (kinda like viewing a zoomed in picture).

Yes, there's canvas.camera. It's just like a normal node, you can move,  
rotate and scale it. So if you do

canvas.camera.position = (5, 5) it will make (5,5) appear at the center of  
you window. If you want to zoom in, you can do
canvas.camera.zoom = (2, 2) and everything will appear double in size.

It is also possible to make upper left (0,0). Right now I haven't made  
this customizable, it will be with one of the next svn checkins. Here's  
the temporary solution:

1) Open floatcanvas2/floatcanvas/nodes/camera.py

2) in the Camera._getViewBox method change "fromRectangleCenterSize" to  
"fromRectangleCornerSize".

3) Save.

Then if you do canvas.camera.position = (5,5) an object placed at (5,5)  
will appear at the top left of the screen.

-Matthias
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to