Reordered gui.HookeFrame methods to group by category
[hooke.git] / hooke / ui / gui / dialog / points.py
1 # Copyright
2
3 import wx
4
5
6 def measure_N_points(hooke_frame, N, message='', block=0):
7     '''
8     General helper function for N-points measurements
9     By default, measurements are done on the retraction
10     '''
11     if message:
12         dialog = wx.MessageDialog(None, message, 'Info', wx.OK)
13         dialog.ShowModal()
14
15     figure = self.GetActiveFigure()
16
17     xvector = self.displayed_plot.curves[block].x
18     yvector = self.displayed_plot.curves[block].y
19
20     clicked_points = figure.ginput(N, timeout=-1, show_clicks=True)
21
22     points = []
23     for clicked_point in clicked_points:
24         point = lib.clickedpoint.ClickedPoint()
25         point.absolute_coords = clicked_point[0], clicked_point[1]
26         point.dest = 0
27         #TODO: make this optional?
28         #so far, the clicked point is taken, not the corresponding data point
29         point.find_graph_coords(xvector, yvector)
30         point.is_line_edge = True
31         point.is_marker = True
32         points.append(point)
33     return points