public void VTKRender(string filePath) { if (renderer != null) { renderer.Clear(); mapper.RemoveAllInputs(); } renderWindowControl1.Refresh(); reader = new Kitware.VTK.vtkSimplePointsReader(); reader.SetFileName(filePath); reader.Update(); mapper = Kitware.VTK.vtkPolyDataMapper.New(); mapper.SetInputConnection(reader.GetOutputPort()); actor = Kitware.VTK.vtkActor.New(); actor.SetMapper(mapper); actor.SetScale(0.01, 0.01, 0.01); actor.GetProperty().SetPointSize(1); renderwindow = renderWindowControl1.RenderWindow; renderer = renderwindow.GetRenderers().GetFirstRenderer(); renderer.SetBackground(0.3, 0.6, 0.3); renderer.AddActor(actor); renderer.Clear(); renderWindowControl1.Refresh(); }
// Static void method with same signature as "Main" is always // file base name: // /// <summary> /// VTK test Main method /// </summary> public static void vtkWin32OpenGLRenderWindowTest(string[] args) { Kitware.VTK.vtkRenderWindow v = Kitware.VTK.vtkRenderWindow.New(); System.Console.WriteLine(v.ToString()); v.Render(); v.Dispose(); }
/// <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) // ); }