def _set_transect_points(self, line_color=None, point_color=(1, 0, 0), **ptargs): if line_color is None: line_color = (1, 0, 0) if point_color is None: point_color = (1, 0, 0) step = self.step cnt = 1 for li in self.lines: p1 = li.start_point p2 = li.end_point # if cnt is None: # cnt = int(p1.identifier) + 1 x, y = p1.x, p1.y tol = step / 3. while 1: x, y = calc_point_along_line(x, y, p2.x, p2.y, step) ptargs['use_border'] = False if abs(p2.x - x) < tol and abs(p2.y - y) < tol: p = self.new_point(p2.x, p2.y, cnt, **ptargs) self.step_points.append(p) cnt += 1 break else: p = self.new_point(x, y, cnt, line_color=line_color, point_color=point_color, **ptargs) self.step_points.append(p) cnt += 1
def _step_trace_path(self, value, path): def step_func(x, y): self.stage_manager.linear_move(x, y, block=True) self.single_burst() sm = self.stage_manager.stage_map line = sm.get_line(path) points = line.points pt = points[0] tol = 0.001 L = 1 x1, y1 = pt.x, pt.y # move to first point step_func(x1, y1) # self._is_tracing = True # self._cancel_tracing = False for pi in points[1:]: x2, y2 = pi.x, pi.y # step along line until cp >=pi while not self._cancel_tracing: x1, y1 = calc_point_along_line(x1, y1, x2, y2, L) step_func(x1, y1) if abs(pi.x - x1) < tol and abs(pi.y - y1) < tol: break self._is_tracing = False
def _step_trace_path(self, value, path): def step_func(x, y): self.stage_manager.linear_move(x, y, block=True) self.single_burst() sm = self.stage_manager._stage_map line = sm.get_line(path) points = line.points pt = points[0] tol = 0.001 L = 1 x1, y1 = pt.x, pt.y # move to first point step_func(x1, y1) # self._is_tracing = True # self._cancel_tracing = False for pi in points[1:]: x2, y2 = pi.x, pi.y # step along line until cp >=pi while not self._cancel_tracing: x1, y1 = calc_point_along_line(x1, y1, x2, y2, L) step_func(x1, y1) if abs(pi.x - x1) < tol and abs(pi.y - y1) < tol: break self._is_tracing = False