Shape
(canvas=None, tag='', color='')[source]¶Displays the polygon objects onto the canvas by supplying draw methods and maintaining internal information on the shape. Draws to matplotlib backend
add_attribute
(attr)[source]¶Append a passed attribute onto the internal attribute list
Parameters: | attr (str) – An attribute enum |
---|
anchor_rectangle
(event)[source]¶Establishes a corner of a rectangle as an anchor for when the user drags the cursor to create a rectangle. Used in ‘Draw Rect’ button
Parameters: | event – A matplotlib backend event object |
---|
clear_lines
()[source]¶Remove any existing lines and clear the shape data. This is called so the lines don’t remain on the screen if the user unclicks the toggleable button.
clear_unfinished_data
()[source]¶In the event the user is plotting points and decides to switch buttons without finishing the free draw polygon, the lines must be cleared and data must be reset. this function will ensure any unfinished data is cleared for future shape drawing.
draw
(fig, fl, plot=0, fill=False)[source]¶Draw the shape to the canvas, onto the passed figure. Only fill the
object if the fill parameter is set to True
Parameters: |
|
---|
fill_rectangle
(event, plot, fl, fig, fill=False)[source]¶Draws the rectangle and stores the coordinates of the rectangle internally. Used
in ‘Draw Rect’ button. Forwards argument parameters to draw
Parameters: |
|
---|
get_coordinates
()[source]¶Return the list of coordinates internally maintained by shape
Return type: | list |
---|
get_itemhandler
()[source]¶Return the item handler object to the actual backend base
Return type: | matplotlib.patches.polygon |
---|
is_attribute
(attr)[source]¶Return True
if attr is inside the attributes list, False
otherwise.
Parameters: | attr (str) – |
---|---|
Return type: | bool |
is_selected
()[source]¶Return a boolean value based on whether the object is currently
highlighted in the figure. Uses __selected
Return type: | bool |
---|
loaded_draw
(fig, fill)[source]¶Called in the case of panning the plot, since panning the plot invalidates the previous figure, the figures must first be cleared and the shapes are removed. Loaded draw draws the shapes back into view using a new figure.
Parameters: |
|
---|
paint
(color)[source]¶Changes the color of the shape and saves it internally
Parameters: | color – the new color of the shape |
---|
plot_point
(event, plot, fl, fig, fill=False)[source]¶Plot a single point to the shape, connect any previous existing points and fill to a shape if the current coordinate intersects the beginning point.
Parameters: |
|
---|
redraw
(fig, fl, fill)[source]¶Function to draw the shape in the event the shape may or may not already be drawn. Checks if the image already exists, if not draws the image
Parameters: |
|
---|
remove
()[source]¶Wrapper function to internally call matplotlib backend to remove the shape from the figure
remove_attribute
(attr)[source]¶Remove an attribute as specified in constants.py
from the internal attributes variable
Parameters: | attr (str) – |
---|
rubberband
(event)[source]¶Draws a temporary helper rectangle that outlines the final shape of the rectangle for the user. This draws to screen coordiantes, so backend is not needed here.
Parameters: | event – A matplotlib.backend_bases.MouseEvent forwarded object. |
---|
set_attributes
(attributes_list)[source]¶Set the internal list of attributes to a custom passed list
Parameters: | attributes_list (list) – |
---|
set_color
(color)[source]¶Set internal color variable
Parameters: | color (str) – Valid hexadecimal color value |
---|
set_coordinates
(coordinates)[source]¶Pass a list of coordinates to set to the shape to.
Parameters: | coordinates (list) – |
---|
set_hdf
(fl)[source]¶Manually set the value of the internal file variable
Parameters: | fl – HDF file path |
---|
set_highlight
(highlight)[source]¶Set the linewidth
and linestyle
attributes of a the internal item
handler. Highlights if highlight is True
, otherwise sets to normal
outline.
Parameters: | highlight (bool) – |
---|
set_id
(_id)[source]¶Set the database ID of the shape. unsafe to use outside letting database call this.
Parameters: | _id (int) – Database primary key |
---|
set_notes
(note)[source]¶Pass a string containing new notes to set the shape to
Parameters: | note (str) – New note string |
---|
set_plot
(plot)[source]¶Manually set the new value of the internal plot variable. unsafe
Parameters: | plot (constants.Plot) – Plot value |
---|