def __init__(self, module_manager): SimpleVTKClassModuleBase.__init__( self, module_manager, vtk.vtkOutlineCornerSource(), 'Processing.', (), ('vtkPolyData',), replaceDoc=True, inputFunctions=None, outputFunctions=None)
def __init__(self, module_manager): SimpleVTKClassModuleBase.__init__(self, module_manager, vtk.vtkOutlineCornerSource(), 'Processing.', (), ('vtkPolyData', ), replaceDoc=True, inputFunctions=None, outputFunctions=None)
def add_bounding_box(self, color=None, corner_factor=0.5, line_width=None, opacity=1.0, render_lines_as_tubes=False, lighting=None, reset_camera=None): """ Adds an unlabeled and unticked box at the boundaries of plot. Useful for when wanting to plot outer grids while still retaining all edges of the boundary. Parameters ---------- corner_factor : float, optional If ``all_edges``, this is the factor along each axis to draw the default box. Dafuault is 0.5 to show the full box. """ if lighting is None: lighting = rcParams['lighting'] self.remove_bounding_box() if color is None: color = rcParams['font']['color'] rgb_color = parse_color(color) self._bounding_box = vtk.vtkOutlineCornerSource() self._bounding_box.SetBounds(self.bounds) self._bounding_box.SetCornerFactor(corner_factor) self._bounding_box.Update() self._box_object = wrap(self._bounding_box.GetOutput()) name = 'BoundingBox({})'.format(hex(id(self._box_object))) mapper = vtk.vtkDataSetMapper() mapper.SetInputData(self._box_object) self.bounding_box_actor, prop = self.add_actor( mapper, reset_camera=reset_camera, name=name) prop.SetColor(rgb_color) prop.SetOpacity(opacity) if render_lines_as_tubes: prop.SetRenderLinesAsTubes(render_lines_as_tubes) # lighting display style if lighting is False: prop.LightingOff() # set line thickness if line_width: prop.SetLineWidth(line_width) prop.SetRepresentationToSurface() return self.bounding_box_actor
def add_bounding_box(self, color="grey", corner_factor=0.5, line_width=None, opacity=1.0, render_lines_as_tubes=False, lighting=None, reset_camera=None, outline=True, culling='front', loc=None): """Add an unlabeled and unticked box at the boundaries of plot. Useful for when wanting to plot outer grids while still retaining all edges of the boundary. Parameters ---------- corner_factor : float, optional If ``all_edges``, this is the factor along each axis to draw the default box. Dafuault is 0.5 to show the full box. corner_factor : float, optional This is the factor along each axis to draw the default box. Dafuault is 0.5 to show the full box. line_width : float, optional Thickness of lines. opacity : float, optional Opacity of mesh. Should be between 0 and 1. Default 1.0 outline : bool Default is ``True``. when False, a box with faces is shown with the specified culling culling : str, optional Does not render faces that are culled. Options are ``'front'`` or ``'back'``. Default is ``'front'`` for bounding box. loc : int, tuple, or list Index of the renderer to add the actor to. For example, ``loc=2`` or ``loc=(1, 1)``. If None, selects the last active Renderer. """ if lighting is None: lighting = rcParams['lighting'] self.remove_bounding_box() if color is None: color = rcParams['outline_color'] rgb_color = parse_color(color) if outline: self._bounding_box = vtk.vtkOutlineCornerSource() self._bounding_box.SetCornerFactor(corner_factor) else: self._bounding_box = vtk.vtkCubeSource() self._bounding_box.SetBounds(self.bounds) self._bounding_box.Update() self._box_object = wrap(self._bounding_box.GetOutput()) name = 'BoundingBox({})'.format(hex(id(self._box_object))) mapper = vtk.vtkDataSetMapper() mapper.SetInputData(self._box_object) self.bounding_box_actor, prop = self.add_actor( mapper, reset_camera=reset_camera, name=name, culling=culling, pickable=False) prop.SetColor(rgb_color) prop.SetOpacity(opacity) if render_lines_as_tubes: prop.SetRenderLinesAsTubes(render_lines_as_tubes) # lighting display style if lighting is False: prop.LightingOff() # set line thickness if line_width: prop.SetLineWidth(line_width) prop.SetRepresentationToSurface() return self.bounding_box_actor