Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _end_pick_event(picker, event):
self.picked_point = np.array(picker.GetPickPosition())
self.picked_mesh = picker.GetDataSet()
self.picked_point_id = picker.GetPointId()
if show_point:
self.add_mesh(self.picked_point, color=color,
point_size=point_size, name='_picked_point',
pickable=False, reset_camera=False, **kwargs)
if hasattr(callback, '__call__'):
if use_mesh:
try_callback(callback, self.picked_mesh, self.picked_point_id)
else:
try_callback(callback, self.picked_point)
def _the_callback(widget, event):
value = widget.GetRepresentation().GetValue()
if hasattr(callback, '__call__'):
if pass_widget:
try_callback(callback, value, widget)
else:
try_callback(callback, value)
return
def _the_callback(widget, event_id):
polyline = pyvista.PolyData()
widget.GetPolyData(polyline)
ribbon.shallow_copy(polyline.ribbon(normal=(0,0,1), angle=90.0))
if hasattr(callback, '__call__'):
if pass_widget:
try_callback(callback, polyline, widget)
else:
try_callback(callback, polyline)
return
def _end_pick_event(picker, event):
self.picked_point = np.array(picker.GetPickPosition())
self.picked_mesh = picker.GetDataSet()
self.picked_point_id = picker.GetPointId()
if show_point:
self.add_mesh(self.picked_point, color=color,
point_size=point_size, name='_picked_point',
pickable=False, reset_camera=False, **kwargs)
if hasattr(callback, '__call__'):
if use_mesh:
try_callback(callback, self.picked_mesh, self.picked_point_id)
else:
try_callback(callback, self.picked_point)
def _the_callback(widget, event):
value = widget.GetRepresentation().GetValue()
if hasattr(callback, '__call__'):
if pass_widget:
try_callback(callback, value, widget)
else:
try_callback(callback, value)
return
def _the_callback(box_widget, event_id):
the_box = pyvista.PolyData()
box_widget.GetPolyData(the_box)
planes = vtk.vtkPlanes()
box_widget.GetPlanes(planes)
if hasattr(callback, '__call__'):
if use_planes:
args = [planes]
else:
args = [the_box]
if pass_widget:
args.append(box_widget)
try_callback(callback, *args)
return
def end_pick_helper(picker, event_id):
if show:
# Use try in case selection is empty
try:
self.add_mesh(self.picked_cells, name='_cell_picking_selection',
style=style, color=color,
line_width=line_width, pickable=False,
reset_camera=False, **kwargs)
except RuntimeError:
pass
if callback is not None and self.picked_cells.n_cells > 0:
try_callback(callback, self.picked_cells)
# TODO: Deactivate selection tool
return
def _the_callback(widget, event_id):
the_plane = vtk.vtkPlane()
widget.GetPlane(the_plane)
normal = the_plane.GetNormal()
origin = the_plane.GetOrigin()
if hasattr(callback, '__call__'):
if pass_widget:
try_callback(callback, normal, origin, widget)
else:
try_callback(callback, normal, origin)
return