public void AddActors() { Kitware.VTK.vtkConeSource source = new Kitware.VTK.vtkConeSource(); source.SetResolution(30); Kitware.VTK.vtkMapper mapper = Kitware.VTK.vtkPolyDataMapper.New(); mapper.SetInputConnection(source.GetOutputPort()); Kitware.VTK.vtkActor actor = new Kitware.VTK.vtkActor(); actor.SetMapper(mapper); Kitware.VTK.vtkTextActor textActor = new Kitware.VTK.vtkTextActor(); textActor.SetInput(Kitware.VTK.vtkVersion.GetVTKSourceVersion()); Kitware.VTK.vtkRenderer ren = this.renderWindowControl1.RenderWindow.GetRenderers().GetFirstRenderer(); ren.AddActor(actor); ren.AddActor(textActor); ren.ResetCamera(); this.renderWindowControl1.RenderWindow.Render(); }
/// <summary> /// TestAddActorsToRenderWindow. /// </summary> private void TestAddActorsToRenderWindow(Kitware.VTK.vtkRenderWindow renWin) { Kitware.VTK.vtkConeSource source = new Kitware.VTK.vtkConeSource(); Kitware.VTK.vtkMapper mapper = Kitware.VTK.vtkPolyDataMapper.New(); mapper.SetInputConnection(source.GetOutputPort()); Kitware.VTK.vtkActor actor = new Kitware.VTK.vtkActor(); actor.SetMapper(mapper); Kitware.VTK.vtkRenderer ren = null; ren = renWin.GetRenderers().GetFirstRenderer(); ren.AddActor(actor); Kitware.VTK.vtkTextActor textActor = new Kitware.VTK.vtkTextActor(); textActor.SetInput(Kitware.VTK.vtkVersion.GetVTKSourceVersion()); ren.AddActor(textActor); //int n = renWin.GetRenderers().GetNumberOfItems(); //System.Diagnostics.Debug.WriteLine(n); //System.Diagnostics.Debug.WriteLine( // Kitware.mummy.Runtime.Methods.Print(false) // ); }