Pierre Schmidt wrote:
> the 0,0 of a floatcanvas2 plane is on the top left of the screen, I
> would like to move it on the bottom left of the screen, I cannot do
> this by rotating the camera, I can inverse all my coordinates but I
> was wondering if there is an option to initialize the canvas with a
> different orign.
I'm a bit confused. I don't think the origin is anywhere in particular.
That's one of the points of FloatCanvas (both one and two) you can point
the camera anywhere you want.
However, from "rotating the camera, I can inverse all my coordinates" I
think you mean you want y to be positive up, rather than down. That was
actually the default with FC1.
Anyway, think the way to change it is to provide a transform that flips
the coords. I'd have thought that Matthias would have provided one out
of the box, but I can't find it.
However, if you look at floatcanvas.math.transform.py, you'll see class
LinearTransform2D, into which you can pass an affine transform matrix.
It defaults to the identity matrix. I think what you want is:
import numpy as np
matrix = np.eye()
matrix[1,1] =-1
(this will give you a matrix that looks like:
1 0 0
0 -1 0
0 0 1
Which I think will flip the y-axis.
y_up_transform = LinearTransform2D(matrix = matrix)
then pass that transform in when you create the canvas:
canvas = fc.NavCanvas( frame,
backgroundColor = 'white',
transform = y_up_transform )
Though I'm only guessing at that part -- I'm not sure how to apply the
transform to the canvas.
Mattias, have I got this right? I took a loook at some of the tests, but
I dind't see an exam[ple -- in mercator_test, there is a transform but
it looks like you are transforming the lines of the map rather than
applying it to the canvas.
For drawing maps, you'd really want the transfrom applied to the
canvawes, so from there on out you could just put objects on the map
without worrying about the projection. Also, youcould then change the
projection of hte canvas, and everything would just work.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas