yup -- but basic or not, knowing that all the DRawObjects can be created without a crash is a big step up!
Another level would be some of the methods like .Move() and .CalcBoundingBox, etc -- we could check if the geometry of the object was computed properly.
It seems some of this could be done with auto-generated tests -- so we can apply the same test to multiple DrawObject types, for instance. That's a bit klunky with unittest, I think -- one reason I like pytest (or nose)
Of course, the real question is if the object actually gets displayed properly -- but I don't know if we want to go there!
looking for the ???:
the event types supported for DrawObject.Bind are:
EVT_FC_LEFT_DOWN
EVT_FC_LEFT_UP
EVT_FC_LEFT_DCLICK
EVT_FC_MIDDLE_DOWN
EVT_FC_MIDDLE_UP
EVT_FC_MIDDLE_DCLICK
EVT_FC_RIGHT_DOWN
EVT_FC_RIGHT_UP
EVT_FC_RIGHT_DCLICK
EVT_FC_ENTER_OBJECT
EVT_FC_LEAVE_OBJECT
The others only apply to the Canvas as a whole, not to individual objects.
+ :param integer `LineWidth`: the width in pixels ???
yes -- pixels is correct.
+ :param integer `Direction`: angle of arrow in degrees, zero is straight
+ up +angle is to the right (theta) ????
correct, but don't need the (theta) -- I think I changed the namem in there at soem point...
def FindClosestPoint(self, XY):
"""
@@ -907,6 +1164,8 @@
This can be used to figure out which point got hit in a mouse
binding callback, for instance. It's a lot faster that using a
lot of separate points.
+
+ :param `XY`: takes a 2-tuple in World coordinates ???
let's try:
:param `XY`: the (x,y) coordinates of the point to look for--takes a 2-tuple or (2,) numpy array in World coordinates
+class Text(TextObjectMixin, DrawObject):
+ """Draws a text object
+
+ ??? do we integrate all this below or ...???
+
yes, I think that all belongs in the constructor docstring.
class ScaledTextBox(TextObjectMixin, DrawObject):
"""
+ ??? what to do with this ??? should it be moved to the appropiate param???
+
This class creates a TextBox object that is scaled when zoomed. It is
placed at the coordinates, x,y.
yes, other than the quick high-level description:
"a multi-line TextBox, which is scaled when zoomed."
The rest should go in the __init__ and/or appropriate methods.
+ :param `Point`: takes a 2-tuple ???
+ :param integer `Size`: size in World pixels ???
opps -- World units.
+ :param `Color`: see :meth:`~lib.floatcanvas.FloatCanvas.DrawObject.SetColor`
+ :param `BackgroundColor`: see :meth:`~lib.floatcanvas.FloatCanvas.DrawObject.SetColor`
+ :param `LineColor`: see :meth:`~lib.floatcanvas.FloatCanvas.DrawObject.SetColor`
+ :param `LineWidth`: see :meth:`~lib.floatcanvas.FloatCanvas.DrawObject.SetLineWidth`
+ :param `Width`: width in pixels or ``None`` ???
yes, this is in pixels (Or None...)
+ :param `PadSize`: padding in pixles or ``None`` ???
This is in World units.
class FloatCanvas(wx.Panel):
"""
- FloatCanvas.py
-
- This is a high level window for drawing maps and anything else in an
- arbitrary coordinate system.
-
+ Do we want this duplicated here???
+
No, that should all be in one place.
+ Default class constructor.
+
+ :param Window `parent`: parent window. Must not be ``None``;
+ :param integer `id`: window identifier. A value of -1 indicates a default value;
+ :param `size`: a tuple or :class:`Size`
+ :param `ProjectionFun`: a custom projection function ???
This allows you to change the transform from world to pixel coordinates. We can point to FloatCanvas.FlatEarthProjection for an example -- though that should really be a class method, or even better, simply a function in the module. There is a tiny bit on info in the error message in FloatCanvas.SetProjectionFun()
(Note: this really should get re-factored to allow more generic projections...)
+ :param string `BackgroundColor`: any value accepted by :class:`Brush`
+ :param `Debug`: activate debug ???
this turns on a smattering of print statements.. not that many really, but we could do more with that.
def FlatEarthProjection(self, CenterPoint):
+ """Set the CenterPoint for FlatEarthProjection ???
+
+ :param `CenterPoint`: takes a 2-tuple, or a (2,)
+ `NumPy <
http://www.numpy.org/>`_ array of point coordinates???
+
+ """
let's try:
"""
compute the scaling array for the flat-earth projection
:param `CenterPoint`: center point of viewport (lon, lat) -- the longitude is scaled to the latitude of this point. a 2-tuple, or a (2,) `NumPy <
http://www.numpy.org/>`_ array of point coordinates
:returns : a (2,) numpy array that scales world coordinates. This scaling is applied when converting to-from world to pixel coordinates.
"""
def AddToolbarModeButtons(self, tb, Modes):
+ """
+ Add the mode buttons to the tool bar.
+
+ :param ToolBar `tb`: the toolbar instance
+ :param list `Modes`: a list of modes to add ??? what is valid ???
+
+ """
There are the modes defined in GUIMode.py, but the user can define their own, as well.
def Bind(self, Event, CallBackFun):
+ """
+ Bind an event to the DrawObject
+
+ :param `Event`: see below for supported event types ???
I think I covered this in the last email, but I think this is it.
+ - EVT_FC_LEFT_DOWN
+ - EVT_FC_LEFT_UP
+ - EVT_FC_LEFT_DCLICK
+ - EVT_FC_MIDDLE_DOWN
+ - EVT_FC_MIDDLE_UP
+ - EVT_FC_MIDDLE_DCLICK
+ - EVT_FC_RIGHT_DOWN
+ - EVT_FC_RIGHT_UP
+ - EVT_FC_RIGHT_DCLICK
Thanks for all this work!