Why the default orign of the FloatCanvas is not on top left corner of the
canvas?
Actually, as FloatCanvas is designed to allow arbitrary panning, the
origin isn't anywhere in particular (though maybe in the middle if you do
nothing, Ii.e not call ZoomToBB(), or Zoom() or ??? )
Currently a float canvas instance is created as follow in my
project. But when try to add rectangle into it, it seems that the default
orgin is at the center of the canvas which means the (0, 0) point is at the
center of the canvas. It's a little difference between other lib's. Is it
possible to switch (0,0) upping left corner? Thanks in advance!
You can move it anywhere you want, but I suspect what you may want is not
so much the origin moved, but the y-increasing-up convention changed to
y-increasing-down.
image software and drawing pixels on screen libs most often use
y-increasing-down convention, but math, science and also things like
postscript, use y-increasing-up, so that's what FC defaults to.
from wx.lib.floatcanvas import NavCanvas, FloatCanvas, Resources
FC = FloatCanvas.FloatCanvas(self, Debug=0)
Canvas.AddRectangle((-x0, y0), (size[0], -size[1]), LineWidth=0, LineColor
(25,25,25), FillColor=(25,25,25))
you can call one of:
FC.MoveImage(self, shift, CoordType, ReDraw=True)
FC.Zoom(self, factor, center=None, centerCoords='world')
FC.ZoomToBB(self, NewBB=None, DrawFlag=True)
to position is like you want.
You can also change the y-up convention by setting the projection function
-- there is an example somewhere I don't have time to dig up at the moment
-- though y-down projections are less well tested.
HTH,
-Chris
···
On Thu, Dec 5, 2013 at 12:08 AM, Erxin <shangerxin@hotmail.com> wrote:
--
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
Chris.Barker@noaa.gov