]> git.saurik.com Git - wxWidgets.git/blob - wxPython/wx/lib/floatcanvas/__init__.py
Added a new version (0.8.3) of FloatCanvas from Chris Barker. It's
[wxWidgets.git] / wxPython / wx / lib / floatcanvas / __init__.py
1 """
2 This is the floatcanvas package. It provides two primary modules, and a
3 support module.
4
5 FloatCanvas.py contains the main FloatCanvas class, and it's supporting
6 classes. NavCanvas.py contains a wrapper for the FloatCanvas that
7 provides the canvas and a toolbar with tools that allow you to navigate
8 the canvas (zooming, panning, etc.) Resources.py is a module that
9 contains a few resources required by the FloatCanvas (icons, etc)
10
11 The FloatCanvas is a high level window for drawing maps and anything
12 else in an arbitrary coordinate system.
13
14 The goal is to provide a convenient way to draw stuff on the screen
15 without having to deal with handling OnPaint events, converting to pixel
16 coordinates, knowing about wxWindows brushes, pens, and colors, etc. It
17 also provides virtually unlimited zooming and scrolling
18
19 I am using it for two things:
20 1) general purpose drawing in floating point coordinates
21 2) displaying map data in Lat-long coordinates
22
23 If the projection is set to None, it will draw in general purpose
24 floating point coordinates. If the projection is set to 'FlatEarth', it
25 will draw a FlatEarth projection, centered on the part of the map that
26 you are viewing. You can also pass in your own projection function.
27
28 It is double buffered, so re-draws after the window is uncovered by
29 something else are very quick.
30
31 It relies on NumPy, which is needed for speed (maybe, I haven't profiled
32 it). It will also use numarray, if you don't have Numeric, but it is
33 slower.
34
35 Bugs and Limitations: Lots: patches, fixes welcome
36
37 For Map drawing: It ignores the fact that the world is, in fact, a
38 sphere, so it will do strange things if you are looking at stuff near
39 the poles or the date line. so far I don't have a need to do that, so I
40 havn't bothered to add any checks for that yet.
41
42 Zooming: I have set no zoom limits. What this means is that if you zoom
43 in really far, you can get integer overflows, and get weird results. It
44 doesn't seem to actually cause any problems other than weird output, at
45 least when I have run it.
46
47 Speed: I have done a couple of things to improve speed in this app. The
48 one thing I have done is used NumPy Arrays to store the coordinates of
49 the points of the objects. This allowed me to use array oriented
50 functions when doing transformations, and should provide some speed
51 improvement for objects with a lot of points (big polygons, polylines,
52 pointsets).
53
54 The real slowdown comes when you have to draw a lot of objects, because
55 you have to call the wx.DC.DrawSomething call each time. This is plenty
56 fast for tens of objects, OK for hundreds of objects, but pretty darn
57 slow for thousands of objects.
58
59 If you are zoomed in, it checks the Bounding box of an object before
60 drawing it. This makes it a great deal faster when there are a lot of
61 objects and you are zoomed in so that only a few are shown.
62
63 One solution is to be able to pass some sort of object set to the DC
64 directly. I've used DC.DrawPointList(Points), and it helped a lot with
65 drawing lots of points. However, when zoomed in, the Bounding boxes need
66 to be checked, so I may some day write C++ code that does the loop and
67 checks the BBs.
68
69 Mouse Events:
70
71 At this point, there are a full set of custom mouse events. They are
72 just like the regular mouse events, but include an extra attribute:
73 Event.GetCoords(), that returns the (x,y) position in world coordinates,
74 as a length-2 NumPy vector of Floats.
75
76 See the Demo for what it can do, and how to use it.
77
78 Copyright: Christopher Barker
79
80 License: Same as the version of wxPython you are using it with.
81
82 Check for updates at:
83 http://home.comcast.net/~chrishbarker/FloatCanvas/
84
85 Please let me know if you're using this!!!
86
87 Contact me at:
88
89 Chris.Barker@noaa.gov
90
91 """
92
93 __version__ = "0.8.3"
94
95