def rayDebug(position, ray): d = DebugData() d.addLine(position, position + ray * 5.0) drcView = app.getViewManager().findView('DRC View') obj = vis.updatePolyData(d.getPolyData(), 'camera ray', view=drcView, color=[0, 1, 0]) obj.actor.GetProperty().SetLineWidth(2)
def init(poseCollection, costCollection): global _spreadsheetView _spreadsheetView = app.getViewManager().createView('Spreadsheet View', 'Spreadsheet View') updateMethod = functools.partial(updateSpreadsheetPoses, poseCollection) poseCollection.connect('itemChanged(const QString&)', updateMethod) poseCollection.connect('itemAdded(const QString&)', updateMethod) poseCollection.connect('itemRemoved(const QString&)', updateMethod) initSpreadsheetColumns(costCollection) updateMethod()
def initView(self, view): self.view = view or app.getViewManager().createView(self.viewName, 'VTK View') self.view.installImageInteractor() self.interactorStyle = self.view.renderWindow().GetInteractor().GetInteractorStyle() self.interactorStyle.AddObserver('SelectionChangedEvent', self.onRubberBandPick) self.imageActor = vtk.vtkImageActor() self.imageActor.SetInput(self.getImage()) self.imageActor.SetVisibility(False) self.view.renderer().AddActor(self.imageActor) self.timerCallback = TimerCallback() self.timerCallback.targetFps = 60 self.timerCallback.callback = self.updateView self.timerCallback.start()
def initView(self, view): self.view = view or app.getViewManager().createView( self.viewName, 'VTK View') self.view.installImageInteractor() self.interactorStyle = self.view.renderWindow().GetInteractor( ).GetInteractorStyle() self.interactorStyle.AddObserver('SelectionChangedEvent', self.onRubberBandPick) self.imageActor = vtk.vtkImageActor() self.imageActor.SetInput(self.getImage()) self.imageActor.SetVisibility(False) self.view.renderer().AddActor(self.imageActor) self.timerCallback = TimerCallback() self.timerCallback.targetFps = 60 self.timerCallback.callback = self.updateView self.timerCallback.start()
def initView(self, view): self.view = view or app.getViewManager().createView('Camera View', 'VTK View') self.renderers = [self.view.renderer()] renWin = self.view.renderWindow() renWin.SetNumberOfLayers(3) for i in [1, 2]: ren = vtk.vtkRenderer() ren.SetLayer(2) ren.SetActiveCamera(self.view.camera()) renWin.AddRenderer(ren) self.renderers.append(ren) def applyCustomBounds(): self.view.addCustomBounds([-100, 100, -100, 100, -100, 100]) self.view.connect('computeBoundsRequest(ddQVTKWidgetView*)', applyCustomBounds) app.setCameraTerrainModeEnabled(self.view, True) self.resetCamera()
def initView(self, view): self.view = view or app.getViewManager().createView( 'Camera View', 'VTK View') self.renderers = [self.view.renderer()] renWin = self.view.renderWindow() renWin.SetNumberOfLayers(3) for i in [1, 2]: ren = vtk.vtkRenderer() ren.SetLayer(2) ren.SetActiveCamera(self.view.camera()) renWin.AddRenderer(ren) self.renderers.append(ren) def applyCustomBounds(): self.view.addCustomBounds([-100, 100, -100, 100, -100, 100]) self.view.connect('computeBoundsRequest(ddQVTKWidgetView*)', applyCustomBounds) app.setCameraTerrainModeEnabled(self.view, True) self.resetCamera()
def rayDebug(position, ray): d = DebugData() d.addLine(position, position+ray*5.0) drcView = app.getViewManager().findView('DRC View') obj = vis.updatePolyData(d.getPolyData(), 'camera ray', view=drcView, color=[0,1,0]) obj.actor.GetProperty().SetLineWidth(2)