1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
using Kitware.VTK;
// Class name is always file base name with "Class" appended:
//
/// <summary>
/// VTK test class
/// </summary>
public class vtkConeSourceTestClass
{
// Static void method with same signature as "Main" is always
// file base name:
//
/// <summary>
/// VTK test Main method
/// </summary>
public static void vtkConeSourceTest(string[] args)
{
bool interactive = false;
foreach (string s in args)
{
// -I means "interactive" test -- do not automatically quit:
//
if (s == "-I")
{
interactive = true;
}
}
vtkConeSource source = new vtkConeSource();
vtkMapper mapper = vtkPolyDataMapper.New();
mapper.SetInputConnection(source.GetOutputPort());
vtkActor actor = new vtkActor();
actor.SetMapper(mapper);
vtkRenderer ren1 = vtkRenderer.New();
ren1.AddActor(actor);
ren1.SetBackground(0.1, 0.2, 0.4);
vtkRenderWindow renWin = vtkRenderWindow.New();
renWin.AddRenderer(ren1);
renWin.SetSize(400, 300);
vtkRenderWindowInteractor iren = vtkRenderWindowInteractor.New();
iren.SetRenderWindow(renWin);
iren.Initialize();
Kitware.mummy.Runtime.Methods.Print(false);
Kitware.mummy.Runtime.Methods.PrintWrappedObjectsTable();
if (interactive)
{
iren.Start();
}
ren1.SetRenderWindow(null);
iren.SetRenderWindow(null);
renWin.Dispose();
}
}
|