|
|
@ -17,16 +17,26 @@ def __handle_add_point(ctx, event): |
|
|
|
the openGL widget that will perform the |
|
|
|
the openGL widget that will perform the |
|
|
|
function. |
|
|
|
function. |
|
|
|
""" |
|
|
|
""" |
|
|
|
print("GOT POINT: ({}, {})".format(event.x(), event.y())) |
|
|
|
print("[ADD] GOT POINT: ({}, {})".format(event.x(), event.y())) |
|
|
|
|
|
|
|
|
|
|
|
def __handle_edit_point(ctx, event): |
|
|
|
def __handle_edit_point(ctx, event): |
|
|
|
print("GOT POINT: ({}, {})".format(event.x(), event.y())) |
|
|
|
# TODO: This function and delete definitely need to make sure they are |
|
|
|
|
|
|
|
# on a point we have. |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
# Since points are unique consider a hashmap of points to make O(1) |
|
|
|
|
|
|
|
# lookups for addition and deletion. This list can be maintained here |
|
|
|
|
|
|
|
# in this module. It should be a dictionary - from point to |
|
|
|
|
|
|
|
# attributes in the case of algorithms that require points to have |
|
|
|
|
|
|
|
# weights or something. |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
print("[EDIT] GOT POINT: ({}, {})".format(event.x(), event.y())) |
|
|
|
|
|
|
|
|
|
|
|
def __handle_delete_point(ctx, event): |
|
|
|
def __handle_delete_point(ctx, event): |
|
|
|
print("GOT POINT: ({}, {})".format(event.x(), event.y())) |
|
|
|
print("[DELETE] GOT POINT: ({}, {})".format(event.x(), event.y())) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Simple dispatch to make life easy for the window. |
|
|
|
# Simple dispatcher to make it easy to dispatch the right mode |
|
|
|
|
|
|
|
# function when the OpenGL window is clicked. |
|
|
|
MODE_MAP = { |
|
|
|
MODE_MAP = { |
|
|
|
Mode.OFF: lambda: None, |
|
|
|
Mode.OFF: lambda: None, |
|
|
|
Mode.ADD: __handle_add_point, |
|
|
|
Mode.ADD: __handle_add_point, |
|
|
|