本文整理汇总了C#中vtkRenderWindow类的典型用法代码示例。如果您正苦于以下问题:C# vtkRenderWindow类的具体用法?C# vtkRenderWindow怎么用?C# vtkRenderWindow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
vtkRenderWindow类属于命名空间,在下文中一共展示了vtkRenderWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AVEnSightOfficeBin
/// <summary>
/// The main entry method called by the CSharp driver
/// </summary>
/// <param name="argv"></param>
public static void AVEnSightOfficeBin(String [] argv)
{
//Prefix Content is: ""
ren1 = vtkRenderer.New();
renWin = vtkRenderWindow.New();
renWin.AddRenderer((vtkRenderer)ren1);
iren = new vtkRenderWindowInteractor();
iren.SetRenderWindow((vtkRenderWindow)renWin);
// read data[]
//[]
reader = new vtkGenericEnSightReader();
// Make sure all algorithms use the composite data pipeline[]
cdp = new vtkCompositeDataPipeline();
vtkGenericEnSightReader.SetDefaultExecutivePrototype((vtkExecutive)cdp);
reader.SetCaseFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/EnSight/office_bin.case");
reader.Update();
// to add coverage for vtkOnePieceExtentTranslator[]
translator = new vtkOnePieceExtentTranslator();
vtkStreamingDemandDrivenPipeline.SetExtentTranslator(reader.GetOutputInformation(0), (vtkExtentTranslator)translator);
outline = new vtkStructuredGridOutlineFilter();
// outline SetInputConnection [reader GetOutputPort][]
outline.SetInputData((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
mapOutline = vtkPolyDataMapper.New();
mapOutline.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
outlineActor = new vtkActor();
outlineActor.SetMapper((vtkMapper)mapOutline);
outlineActor.GetProperty().SetColor((double)0,(double)0,(double)0);
// Create source for streamtubes[]
streamer = new vtkStreamPoints();
// streamer SetInputConnection [reader GetOutputPort][]
streamer.SetInputData((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
streamer.SetStartPosition((double)0.1,(double)2.1,(double)0.5);
streamer.SetMaximumPropagationTime((double)500);
streamer.SetTimeIncrement((double)0.5);
streamer.SetIntegrationDirectionToForward();
cone = new vtkConeSource();
cone.SetResolution((int)8);
cones = new vtkGlyph3D();
cones.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
cones.SetSourceConnection(cone.GetOutputPort());
cones.SetScaleFactor((double)0.9);
cones.SetScaleModeToScaleByVector();
mapCones = vtkPolyDataMapper.New();
mapCones.SetInputConnection((vtkAlgorithmOutput)cones.GetOutputPort());
// eval mapCones SetScalarRange [[reader GetOutput] GetScalarRange][]
mapCones.SetScalarRange((double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetScalarRange()[0],
(double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetScalarRange()[1]);
conesActor = new vtkActor();
conesActor.SetMapper((vtkMapper)mapCones);
ren1.AddActor((vtkProp)outlineActor);
ren1.AddActor((vtkProp)conesActor);
ren1.SetBackground((double)0.4,(double)0.4,(double)0.5);
renWin.SetSize((int)300,(int)300);
iren.Initialize();
// interact with data[]
vtkGenericEnSightReader.SetDefaultExecutivePrototype(null);
//deleteAllVTKObjects();
}
示例2: AVTestExtrudePiece
/// <summary>
/// The main entry method called by the CSharp driver
/// </summary>
/// <param name="argv"></param>
public static void AVTestExtrudePiece(String [] argv)
{
//Prefix Content is: ""
disk = new vtkDiskSource();
disk.SetRadialResolution((int)2);
disk.SetCircumferentialResolution((int)9);
clean = new vtkCleanPolyData();
clean.SetInputConnection((vtkAlgorithmOutput)disk.GetOutputPort());
clean.SetTolerance((double)0.01);
piece = new vtkExtractPolyDataPiece();
piece.SetInputConnection((vtkAlgorithmOutput)clean.GetOutputPort());
extrude = new vtkPLinearExtrusionFilter();
extrude.SetInputConnection((vtkAlgorithmOutput)piece.GetOutputPort());
extrude.PieceInvariantOn();
// Create the RenderWindow, Renderer and both Actors[]
//[]
ren1 = vtkRenderer.New();
renWin = vtkRenderWindow.New();
renWin.AddRenderer((vtkRenderer)ren1);
iren = new vtkRenderWindowInteractor();
iren.SetRenderWindow((vtkRenderWindow)renWin);
mapper = vtkPolyDataMapper.New();
mapper.SetInputConnection((vtkAlgorithmOutput)extrude.GetOutputPort());
mapper.SetNumberOfPieces((int)2);
mapper.SetPiece((int)1);
bf = new vtkProperty();
bf.SetColor((double)1,(double)0,(double)0);
actor = new vtkActor();
actor.SetMapper((vtkMapper)mapper);
actor.GetProperty().SetColor((double)1,(double)1,(double)0.8);
actor.SetBackfaceProperty((vtkProperty)bf);
// Add the actors to the renderer, set the background and size[]
//[]
ren1.AddActor((vtkProp)actor);
ren1.SetBackground((double)0.1,(double)0.2,(double)0.4);
renWin.SetSize((int)300,(int)300);
// render the image[]
//[]
cam1 = ren1.GetActiveCamera();
cam1.Azimuth((double)20);
cam1.Elevation((double)40);
ren1.ResetCamera();
cam1.Zoom((double)1.2);
iren.Initialize();
// prevent the tk window from showing up then start the event loop[]
//deleteAllVTKObjects();
}
示例3: AVTestExtractVOI
/// <summary>
/// The main entry method called by the CSharp driver
/// </summary>
/// <param name="argv"></param>
public static void AVTestExtractVOI(String [] argv)
{
//Prefix Content is: ""
// to mark the origin[]
sphere = new vtkSphereSource();
sphere.SetRadius((double)2.0);
sphereMapper = vtkPolyDataMapper.New();
sphereMapper.SetInputConnection((vtkAlgorithmOutput)sphere.GetOutputPort());
sphereMapper.ImmediateModeRenderingOn();
sphereActor = new vtkActor();
sphereActor.SetMapper((vtkMapper)sphereMapper);
rt = new vtkRTAnalyticSource();
rt.SetWholeExtent((int)-50,(int)50,(int)-50,(int)50,(int)0,(int)0);
voi = new vtkExtractVOI();
voi.SetInputConnection((vtkAlgorithmOutput)rt.GetOutputPort());
voi.SetVOI((int)-11,(int)39,(int)5,(int)45,(int)0,(int)0);
voi.SetSampleRate((int)5,(int)5,(int)1);
// Get rid ambiguous triagulation issues.[]
surf = new vtkDataSetSurfaceFilter();
surf.SetInputConnection((vtkAlgorithmOutput)voi.GetOutputPort());
tris = new vtkTriangleFilter();
tris.SetInputConnection((vtkAlgorithmOutput)surf.GetOutputPort());
mapper = vtkPolyDataMapper.New();
mapper.SetInputConnection((vtkAlgorithmOutput)tris.GetOutputPort());
mapper.ImmediateModeRenderingOn();
mapper.SetScalarRange((double)130,(double)280);
actor = new vtkActor();
actor.SetMapper((vtkMapper)mapper);
ren = vtkRenderer.New();
ren.AddActor((vtkProp)actor);
ren.AddActor((vtkProp)sphereActor);
ren.ResetCamera();
camera = ren.GetActiveCamera();
//$camera SetPosition 68.1939 -23.4323 12.6465[]
//$camera SetViewUp 0.46563 0.882375 0.0678508 []
//$camera SetFocalPoint 3.65707 11.4552 1.83509 []
//$camera SetClippingRange 59.2626 101.825 []
renWin = vtkRenderWindow.New();
renWin.AddRenderer((vtkRenderer)ren);
iren = new vtkRenderWindowInteractor();
iren.SetRenderWindow((vtkRenderWindow)renWin);
iren.Initialize();
//deleteAllVTKObjects();
}
示例4: AVRectOutline
/// <summary>
/// The main entry method called by the CSharp driver
/// </summary>
/// <param name="argv"></param>
public static void AVRectOutline(String [] argv)
{
//Prefix Content is: ""
// create pipeline[]
//[]
reader = new vtkDataSetReader();
reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/RectGrid2.vtk");
reader.Update();
// here to force exact extent[]
elev = new vtkElevationFilter();
elev.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
outline = new vtkRectilinearGridOutlineFilter();
outline.SetInput((vtkDataObject)elev.GetRectilinearGridOutput());
outlineMapper = vtkPolyDataMapper.New();
outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
outlineMapper.SetNumberOfPieces((int)2);
outlineMapper.SetPiece((int)1);
outlineActor = new vtkActor();
outlineActor.SetMapper((vtkMapper)outlineMapper);
outlineActor.GetProperty().SetColor((double) 0.0000, 0.0000, 0.0000 );
// Graphics stuff[]
// Create the RenderWindow, Renderer and both Actors[]
//[]
ren1 = vtkRenderer.New();
renWin = vtkRenderWindow.New();
renWin.AddRenderer((vtkRenderer)ren1);
iren = new vtkRenderWindowInteractor();
iren.SetRenderWindow((vtkRenderWindow)renWin);
// Add the actors to the renderer, set the background and size[]
//[]
ren1.AddActor((vtkProp)outlineActor);
ren1.SetBackground((double)1,(double)1,(double)1);
renWin.SetSize((int)400,(int)400);
cam1 = ren1.GetActiveCamera();
cam1.SetClippingRange((double)3.76213,(double)10.712);
cam1.SetFocalPoint((double)-0.0842503,(double)-0.136905,(double)0.610234);
cam1.SetPosition((double)2.53813,(double)2.2678,(double)-5.22172);
cam1.SetViewUp((double)-0.241047,(double)0.930635,(double)0.275343);
iren.Initialize();
// render the image[]
//[]
// prevent the tk window from showing up then start the event loop[]
//deleteAllVTKObjects();
}
示例5: AVTestUnstructuredPieces
/// <summary>
/// The main entry method called by the CSharp driver
/// </summary>
/// <param name="argv"></param>
public static void AVTestUnstructuredPieces(String [] argv)
{
//Prefix Content is: ""
math = new vtkMath();
vtkMath.RandomSeed((int)22);
pf = new vtkParallelFactory();
vtkParallelFactory.RegisterFactory((vtkObjectFactory)pf);
pl3d = new vtkMultiBlockPLOT3DReader();
pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin");
pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin");
pl3d.SetScalarFunctionNumber((int)100);
dst = new vtkDataSetTriangleFilter();
dst.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
extract = new vtkExtractUnstructuredGridPiece();
extract.SetInputConnection((vtkAlgorithmOutput)dst.GetOutputPort());
cf = new vtkContourFilter();
cf.SetInputConnection((vtkAlgorithmOutput)extract.GetOutputPort());
cf.SetValue((int)0,(double)0.24);
pdn = new vtkPolyDataNormals();
pdn.SetInputConnection((vtkAlgorithmOutput)cf.GetOutputPort());
ps = new vtkPieceScalars();
ps.SetInputConnection((vtkAlgorithmOutput)pdn.GetOutputPort());
mapper = vtkPolyDataMapper.New();
mapper.SetInputConnection((vtkAlgorithmOutput)ps.GetOutputPort());
mapper.SetNumberOfPieces((int)3);
actor = new vtkActor();
actor.SetMapper((vtkMapper)mapper);
ren = vtkRenderer.New();
ren.AddActor((vtkProp)actor);
ren.ResetCamera();
camera = ren.GetActiveCamera();
//$camera SetPosition 68.1939 -23.4323 12.6465[]
//$camera SetViewUp 0.46563 0.882375 0.0678508 []
//$camera SetFocalPoint 3.65707 11.4552 1.83509 []
//$camera SetClippingRange 59.2626 101.825 []
renWin = vtkRenderWindow.New();
renWin.AddRenderer((vtkRenderer)ren);
iren = new vtkRenderWindowInteractor();
iren.SetRenderWindow((vtkRenderWindow)renWin);
iren.Initialize();
//deleteAllVTKObjects();
}
示例6: Main
///<summary>Entry Point</summary>
static void Main(string[] args)
{
// Create a simple sphere. A pipeline is created.
sphere = vtkSphereSource.New();
sphere.SetThetaResolution(8);
sphere.SetPhiResolution(16);
shrink = vtkShrinkPolyData.New();
shrink.SetInputConnection(sphere.GetOutputPort());
shrink.SetShrinkFactor(0.9);
mapper = vtkPolyDataMapper.New();
mapper.SetInputConnection(shrink.GetOutputPort());
// The actor links the data pipeline to the rendering subsystem
actor = vtkActor.New();
actor.SetMapper(mapper);
actor.GetProperty().SetColor(1, 0, 0);
// Create components of the rendering subsystem
//
ren1 = vtkRenderer.New();
renWin = vtkRenderWindow.New();
renWin.AddRenderer(ren1);
iren = vtkRenderWindowInteractor.New();
iren.SetRenderWindow(renWin);
// Add the actors to the renderer, set the window size
//
ren1.AddViewProp(actor);
renWin.SetSize(250, 250);
renWin.Render();
camera = ren1.GetActiveCamera();
camera.Zoom(1.5);
// render the image and start the event loop
//
renWin.Render();
iren.Initialize();
iren.Start();
deleteAllVTKObjects();
}
示例7: AVTestSpherePuzzle
/// <summary>
/// The main entry method called by the CSharp driver
/// </summary>
/// <param name="argv"></param>
public static void AVTestSpherePuzzle(String [] argv)
{
//Prefix Content is: ""
// prevent the tk window from showing up then start the event loop[]
renWin = vtkRenderWindow.New();
// create a rendering window and renderer[]
ren1 = vtkRenderer.New();
renWin.AddRenderer((vtkRenderer)ren1);
renWin.SetSize((int)400,(int)400);
puzzle = new vtkSpherePuzzle();
mapper = vtkPolyDataMapper.New();
mapper.SetInputConnection((vtkAlgorithmOutput)puzzle.GetOutputPort());
actor = new vtkActor();
actor.SetMapper((vtkMapper)mapper);
arrows = new vtkSpherePuzzleArrows();
mapper2 = vtkPolyDataMapper.New();
mapper2.SetInputConnection((vtkAlgorithmOutput)arrows.GetOutputPort());
actor2 = new vtkActor();
actor2.SetMapper((vtkMapper)mapper2);
// Add the actors to the renderer, set the background and size[]
//[]
ren1.AddActor((vtkProp)actor);
ren1.AddActor((vtkProp)actor2);
ren1.SetBackground((double)0.1,(double)0.2,(double)0.4);
LastVal = -1;
//method moved
//method moved
renWin.Render();
cam = ren1.GetActiveCamera();
cam.Elevation((double)-40);
puzzle.MoveHorizontal((int)0,(int)100,(int)0);
puzzle.MoveHorizontal((int)1,(int)100,(int)1);
puzzle.MoveHorizontal((int)2,(int)100,(int)0);
puzzle.MoveVertical((int)2,(int)100,(int)0);
puzzle.MoveVertical((int)1,(int)100,(int)0);
renWin.Render();
//deleteAllVTKObjects();
}
示例8: Main
/// <summary>
/// Entry Point
/// </summary>
/// <param name="argv"></param>
public static void Main(String[] argv)
{
// This example demonstrates how to use 2D Delaunay triangulation.
// We create a fancy image of a 2D Delaunay triangulation. Points are
// randomly generated.
// first we load in the standard vtk packages into tcl
// Generate some random points
math = vtkMath.New();
points = vtkPoints.New();
for(int i = 0; i < 50; i++)
{
points.InsertPoint(i, vtkMath.Random(0, 1), vtkMath.Random(0, 1), 0.0);
}
// Create a polydata with the points we just created.
profile = vtkPolyData.New();
profile.SetPoints(points);
// Perform a 2D Delaunay triangulation on them.
del = vtkDelaunay2D.New();
del.SetInput(profile);
del.SetTolerance(0.001);
mapMesh = vtkPolyDataMapper.New();
mapMesh.SetInputConnection(del.GetOutputPort());
meshActor = vtkActor.New();
meshActor.SetMapper(mapMesh);
meshActor.GetProperty().SetColor(.1, .2, .4);
// We will now create a nice looking mesh by wrapping the edges in tubes,
// and putting fat spheres at the points.
extract = vtkExtractEdges.New();
extract.SetInputConnection(del.GetOutputPort());
tubes = vtkTubeFilter.New();
tubes.SetInputConnection(extract.GetOutputPort());
tubes.SetRadius(0.01);
tubes.SetNumberOfSides(6);
mapEdges = vtkPolyDataMapper.New();
mapEdges.SetInputConnection(tubes.GetOutputPort());
edgeActor = vtkActor.New();
edgeActor.SetMapper(mapEdges);
edgeActor.GetProperty().SetColor(0.2000, 0.6300, 0.7900);
edgeActor.GetProperty().SetSpecularColor(1, 1, 1);
edgeActor.GetProperty().SetSpecular(0.3);
edgeActor.GetProperty().SetSpecularPower(20);
edgeActor.GetProperty().SetAmbient(0.2);
edgeActor.GetProperty().SetDiffuse(0.8);
ball = vtkSphereSource.New();
ball.SetRadius(0.025);
ball.SetThetaResolution(12);
ball.SetPhiResolution(12);
balls = vtkGlyph3D.New();
balls.SetInputConnection(del.GetOutputPort());
balls.SetSourceConnection(ball.GetOutputPort());
mapBalls = vtkPolyDataMapper.New();
mapBalls.SetInputConnection(balls.GetOutputPort());
ballActor = vtkActor.New();
ballActor.SetMapper(mapBalls);
ballActor.GetProperty().SetColor(1.0000, 0.4118, 0.7059);
ballActor.GetProperty().SetSpecularColor(1, 1, 1);
ballActor.GetProperty().SetSpecular(0.3);
ballActor.GetProperty().SetSpecularPower(20);
ballActor.GetProperty().SetAmbient(0.2);
ballActor.GetProperty().SetDiffuse(0.8);
// Create graphics objects
// Create the rendering window, renderer, and interactive renderer
ren1 = vtkRenderer.New();
renWin = vtkRenderWindow.New();
renWin.AddRenderer(ren1);
iren = vtkRenderWindowInteractor.New();
iren.SetRenderWindow(renWin);
// Add the actors to the renderer, set the background and size
ren1.AddActor(ballActor);
ren1.AddActor(edgeActor);
ren1.SetBackground(1, 1, 1);
renWin.SetSize(150, 150);
// render the image
ren1.ResetCamera();
ren1.GetActiveCamera().Zoom(1.5);
iren.Initialize();
iren.Start();
// Clean Up
deleteAllVTKObjects();
}
示例9: AVofficeStreamPoints
/// <summary>
/// The main entry method called by the CSharp driver
/// </summary>
/// <param name="argv"></param>
public static void AVofficeStreamPoints(String [] argv)
{
//Prefix Content is: ""
ren1 = vtkRenderer.New();
renWin = vtkRenderWindow.New();
renWin.AddRenderer((vtkRenderer)ren1);
iren = new vtkRenderWindowInteractor();
iren.SetRenderWindow((vtkRenderWindow)renWin);
// read data[]
//[]
reader = new vtkStructuredGridReader();
reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/office.binary.vtk");
reader.Update();
//force a read to occur[]
// to add coverage for vtkOnePieceExtentTranslator[]
translator = new vtkOnePieceExtentTranslator();
vtkStreamingDemandDrivenPipeline.SetExtentTranslator(reader.GetOutputInformation(0), (vtkExtentTranslator)translator);
length = reader.GetOutput().GetLength();
maxVelocity = reader.GetOutput().GetPointData().GetVectors().GetMaxNorm();
maxTime = 35.0*length/maxVelocity;
table1 = new vtkStructuredGridGeometryFilter();
table1.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
table1.SetExtent((int)11,(int)15,(int)7,(int)9,(int)8,(int)8);
mapTable1 = vtkPolyDataMapper.New();
mapTable1.SetInputConnection((vtkAlgorithmOutput)table1.GetOutputPort());
mapTable1.ScalarVisibilityOff();
table1Actor = new vtkActor();
table1Actor.SetMapper((vtkMapper)mapTable1);
table1Actor.GetProperty().SetColor((double).59,(double).427,(double).392);
table2 = new vtkStructuredGridGeometryFilter();
table2.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
table2.SetExtent((int)11,(int)15,(int)10,(int)12,(int)8,(int)8);
mapTable2 = vtkPolyDataMapper.New();
mapTable2.SetInputConnection((vtkAlgorithmOutput)table2.GetOutputPort());
mapTable2.ScalarVisibilityOff();
table2Actor = new vtkActor();
table2Actor.SetMapper((vtkMapper)mapTable2);
table2Actor.GetProperty().SetColor((double).59,(double).427,(double).392);
FilingCabinet1 = new vtkStructuredGridGeometryFilter();
FilingCabinet1.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
FilingCabinet1.SetExtent((int)15,(int)15,(int)7,(int)9,(int)0,(int)8);
mapFilingCabinet1 = vtkPolyDataMapper.New();
mapFilingCabinet1.SetInputConnection((vtkAlgorithmOutput)FilingCabinet1.GetOutputPort());
mapFilingCabinet1.ScalarVisibilityOff();
FilingCabinet1Actor = new vtkActor();
FilingCabinet1Actor.SetMapper((vtkMapper)mapFilingCabinet1);
FilingCabinet1Actor.GetProperty().SetColor((double).8,(double).8,(double).6);
FilingCabinet2 = new vtkStructuredGridGeometryFilter();
FilingCabinet2.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
FilingCabinet2.SetExtent((int)15,(int)15,(int)10,(int)12,(int)0,(int)8);
mapFilingCabinet2 = vtkPolyDataMapper.New();
mapFilingCabinet2.SetInputConnection((vtkAlgorithmOutput)FilingCabinet2.GetOutputPort());
mapFilingCabinet2.ScalarVisibilityOff();
FilingCabinet2Actor = new vtkActor();
FilingCabinet2Actor.SetMapper((vtkMapper)mapFilingCabinet2);
FilingCabinet2Actor.GetProperty().SetColor((double).8,(double).8,(double).6);
bookshelf1Top = new vtkStructuredGridGeometryFilter();
bookshelf1Top.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
bookshelf1Top.SetExtent((int)13,(int)13,(int)0,(int)4,(int)0,(int)11);
mapBookshelf1Top = vtkPolyDataMapper.New();
mapBookshelf1Top.SetInputConnection((vtkAlgorithmOutput)bookshelf1Top.GetOutputPort());
mapBookshelf1Top.ScalarVisibilityOff();
bookshelf1TopActor = new vtkActor();
bookshelf1TopActor.SetMapper((vtkMapper)mapBookshelf1Top);
bookshelf1TopActor.GetProperty().SetColor((double).8,(double).8,(double).6);
bookshelf1Bottom = new vtkStructuredGridGeometryFilter();
bookshelf1Bottom.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
bookshelf1Bottom.SetExtent((int)20,(int)20,(int)0,(int)4,(int)0,(int)11);
mapBookshelf1Bottom = vtkPolyDataMapper.New();
mapBookshelf1Bottom.SetInputConnection((vtkAlgorithmOutput)bookshelf1Bottom.GetOutputPort());
mapBookshelf1Bottom.ScalarVisibilityOff();
bookshelf1BottomActor = new vtkActor();
bookshelf1BottomActor.SetMapper((vtkMapper)mapBookshelf1Bottom);
bookshelf1BottomActor.GetProperty().SetColor((double).8,(double).8,(double).6);
bookshelf1Front = new vtkStructuredGridGeometryFilter();
bookshelf1Front.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
bookshelf1Front.SetExtent((int)13,(int)20,(int)0,(int)0,(int)0,(int)11);
mapBookshelf1Front = vtkPolyDataMapper.New();
mapBookshelf1Front.SetInputConnection((vtkAlgorithmOutput)bookshelf1Front.GetOutputPort());
mapBookshelf1Front.ScalarVisibilityOff();
bookshelf1FrontActor = new vtkActor();
bookshelf1FrontActor.SetMapper((vtkMapper)mapBookshelf1Front);
bookshelf1FrontActor.GetProperty().SetColor((double).8,(double).8,(double).6);
bookshelf1Back = new vtkStructuredGridGeometryFilter();
bookshelf1Back.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
bookshelf1Back.SetExtent((int)13,(int)20,(int)4,(int)4,(int)0,(int)11);
mapBookshelf1Back = vtkPolyDataMapper.New();
mapBookshelf1Back.SetInputConnection((vtkAlgorithmOutput)bookshelf1Back.GetOutputPort());
mapBookshelf1Back.ScalarVisibilityOff();
bookshelf1BackActor = new vtkActor();
bookshelf1BackActor.SetMapper((vtkMapper)mapBookshelf1Back);
bookshelf1BackActor.GetProperty().SetColor((double).8,(double).8,(double).6);
bookshelf1LHS = new vtkStructuredGridGeometryFilter();
bookshelf1LHS.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
bookshelf1LHS.SetExtent((int)13,(int)20,(int)0,(int)4,(int)0,(int)0);
//.........这里部分代码省略.........
示例10: AVpolyConn
/// <summary>
/// The main entry method called by the CSharp driver
/// </summary>
/// <param name="argv"></param>
public static void AVpolyConn(String [] argv)
{
//Prefix Content is: ""
// Create the RenderWindow, Renderer and both Actors[]
//[]
ren1 = vtkRenderer.New();
renWin = vtkRenderWindow.New();
renWin.AddRenderer((vtkRenderer)ren1);
iren = new vtkRenderWindowInteractor();
iren.SetRenderWindow((vtkRenderWindow)renWin);
// read data[]
//[]
pl3d = new vtkMultiBlockPLOT3DReader();
pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin");
pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin");
pl3d.SetScalarFunctionNumber((int)100);
pl3d.SetVectorFunctionNumber((int)202);
pl3d.Update();
// planes to connect[]
plane1 = new vtkStructuredGridGeometryFilter();
plane1.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
plane1.SetExtent((int)20,(int)20,(int)0,(int)100,(int)0,(int)100);
conn = new vtkPolyDataConnectivityFilter();
conn.SetInputConnection((vtkAlgorithmOutput)plane1.GetOutputPort());
conn.ScalarConnectivityOn();
conn.SetScalarRange((double)0.19,(double)0.25);
plane1Map = vtkPolyDataMapper.New();
plane1Map.SetInputConnection((vtkAlgorithmOutput)conn.GetOutputPort());
plane1Map.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
(double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
plane1Actor = new vtkActor();
plane1Actor.SetMapper((vtkMapper)plane1Map);
plane1Actor.GetProperty().SetOpacity((double)0.999);
// outline[]
outline = new vtkStructuredGridOutlineFilter();
outline.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
outlineMapper = vtkPolyDataMapper.New();
outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
outlineActor = new vtkActor();
outlineActor.SetMapper((vtkMapper)outlineMapper);
outlineProp = outlineActor.GetProperty();
outlineProp.SetColor((double)0,(double)0,(double)0);
// Add the actors to the renderer, set the background and size[]
//[]
ren1.AddActor((vtkProp)outlineActor);
ren1.AddActor((vtkProp)plane1Actor);
ren1.SetBackground((double)1,(double)1,(double)1);
renWin.SetSize((int)300,(int)300);
cam1 = new vtkCamera();
cam1.SetClippingRange((double)14.29,(double)63.53);
cam1.SetFocalPoint((double)8.58522,(double)1.58266,(double)30.6486);
cam1.SetPosition((double)37.6808,(double)-20.1298,(double)35.4016);
cam1.SetViewAngle((double)30);
cam1.SetViewUp((double)-0.0566235,(double)0.140504,(double)0.98846);
ren1.SetActiveCamera((vtkCamera)cam1);
iren.Initialize();
// render the image[]
//[]
// prevent the tk window from showing up then start the event loop[]
//deleteAllVTKObjects();
}
示例11: AVlabeledContours
/// <summary>
/// The main entry method called by the CSharp driver
/// </summary>
/// <param name="argv"></param>
public static void AVlabeledContours(String [] argv)
{
//Prefix Content is: ""
// demonstrate labeling of contour with scalar value[]
// Create the RenderWindow, Renderer and both Actors[]
//[]
ren1 = vtkRenderer.New();
renWin = vtkRenderWindow.New();
renWin.SetMultiSamples(0);
renWin.AddRenderer((vtkRenderer)ren1);
iren = new vtkRenderWindowInteractor();
iren.SetRenderWindow((vtkRenderWindow)renWin);
// Read a slice and contour it[]
v16 = new vtkVolume16Reader();
v16.SetDataDimensions((int)64,(int)64);
v16.GetOutput().SetOrigin((double)0.0,(double)0.0,(double)0.0);
v16.SetDataByteOrderToLittleEndian();
v16.SetFilePrefix((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/headsq/quarter");
v16.SetImageRange((int)45,(int)45);
v16.SetDataSpacing((double)3.2,(double)3.2,(double)1.5);
iso = new vtkContourFilter();
iso.SetInputConnection((vtkAlgorithmOutput)v16.GetOutputPort());
iso.GenerateValues((int)6,(double)500,(double)1150);
iso.Update();
numPts = iso.GetOutput().GetNumberOfPoints();
isoMapper = vtkPolyDataMapper.New();
isoMapper.SetInputConnection((vtkAlgorithmOutput)iso.GetOutputPort());
isoMapper.ScalarVisibilityOn();
isoMapper.SetScalarRange((double)((vtkDataSet)iso.GetOutput()).GetScalarRange()[0],(double)((vtkDataSet)iso.GetOutput()).GetScalarRange()[1]);
isoActor = new vtkActor();
isoActor.SetMapper((vtkMapper)isoMapper);
// Subsample the points and label them[]
mask = new vtkMaskPoints();
mask.SetInputConnection((vtkAlgorithmOutput)iso.GetOutputPort());
mask.SetOnRatio((int)(numPts/50));
mask.SetMaximumNumberOfPoints((int)50);
mask.RandomModeOn();
// Create labels for points - only show visible points[]
visPts = new vtkSelectVisiblePoints();
visPts.SetInputConnection((vtkAlgorithmOutput)mask.GetOutputPort());
visPts.SetRenderer((vtkRenderer)ren1);
ldm = new vtkLabeledDataMapper();
ldm.SetInputConnection((vtkAlgorithmOutput)mask.GetOutputPort());
// ldm SetLabelFormat "%g"[]
ldm.SetLabelModeToLabelScalars();
tprop = ldm.GetLabelTextProperty();
tprop.SetFontFamilyToArial();
tprop.SetFontSize((int)10);
tprop.SetColor((double)1,(double)0,(double)0);
contourLabels = new vtkActor2D();
contourLabels.SetMapper((vtkMapper2D)ldm);
// Add the actors to the renderer, set the background and size[]
//[]
ren1.AddActor2D((vtkProp)isoActor);
ren1.AddActor2D((vtkProp)contourLabels);
ren1.SetBackground((double)1,(double)1,(double)1);
renWin.SetSize((int)500,(int)500);
renWin.Render();
ren1.GetActiveCamera().Zoom((double)1.5);
// render the image[]
//[]
// prevent the tk window from showing up then start the event loop[]
//deleteAllVTKObjects();
}
示例12: AVTestCellDerivs
/// <summary>
/// The main entry method called by the CSharp driver
/// </summary>
/// <param name="argv"></param>
public static void AVTestCellDerivs(String [] argv)
{
//Prefix Content is: ""
// Demonstrates vtkCellDerivatives for all cell types[]
//[]
// get the interactor ui[]
ren1 = vtkRenderer.New();
renWin = vtkRenderWindow.New();
renWin.AddRenderer((vtkRenderer)ren1);
iren = new vtkRenderWindowInteractor();
iren.SetRenderWindow((vtkRenderWindow)renWin);
// create a scene with one of each cell type[]
// Voxel[]
voxelPoints = new vtkPoints();
voxelPoints.SetNumberOfPoints((int)8);
voxelPoints.InsertPoint((int)0,(double)0,(double)0,(double)0);
voxelPoints.InsertPoint((int)1,(double)1,(double)0,(double)0);
voxelPoints.InsertPoint((int)2,(double)0,(double)1,(double)0);
voxelPoints.InsertPoint((int)3,(double)1,(double)1,(double)0);
voxelPoints.InsertPoint((int)4,(double)0,(double)0,(double)1);
voxelPoints.InsertPoint((int)5,(double)1,(double)0,(double)1);
voxelPoints.InsertPoint((int)6,(double)0,(double)1,(double)1);
voxelPoints.InsertPoint((int)7,(double)1,(double)1,(double)1);
aVoxel = new vtkVoxel();
aVoxel.GetPointIds().SetId((int)0,(int)0);
aVoxel.GetPointIds().SetId((int)1,(int)1);
aVoxel.GetPointIds().SetId((int)2,(int)2);
aVoxel.GetPointIds().SetId((int)3,(int)3);
aVoxel.GetPointIds().SetId((int)4,(int)4);
aVoxel.GetPointIds().SetId((int)5,(int)5);
aVoxel.GetPointIds().SetId((int)6,(int)6);
aVoxel.GetPointIds().SetId((int)7,(int)7);
aVoxelGrid = new vtkUnstructuredGrid();
aVoxelGrid.Allocate((int)1,(int)1);
aVoxelGrid.InsertNextCell((int)aVoxel.GetCellType(),(vtkIdList)aVoxel.GetPointIds());
aVoxelGrid.SetPoints((vtkPoints)voxelPoints);
aVoxelMapper = new vtkDataSetMapper();
aVoxelMapper.SetInput((vtkDataSet)aVoxelGrid);
aVoxelActor = new vtkActor();
aVoxelActor.SetMapper((vtkMapper)aVoxelMapper);
aVoxelActor.GetProperty().BackfaceCullingOn();
// Hexahedron[]
hexahedronPoints = new vtkPoints();
hexahedronPoints.SetNumberOfPoints((int)8);
hexahedronPoints.InsertPoint((int)0,(double)0,(double)0,(double)0);
hexahedronPoints.InsertPoint((int)1,(double)1,(double)0,(double)0);
hexahedronPoints.InsertPoint((int)2,(double)1,(double)1,(double)0);
hexahedronPoints.InsertPoint((int)3,(double)0,(double)1,(double)0);
hexahedronPoints.InsertPoint((int)4,(double)0,(double)0,(double)1);
hexahedronPoints.InsertPoint((int)5,(double)1,(double)0,(double)1);
hexahedronPoints.InsertPoint((int)6,(double)1,(double)1,(double)1);
hexahedronPoints.InsertPoint((int)7,(double)0,(double)1,(double)1);
aHexahedron = new vtkHexahedron();
aHexahedron.GetPointIds().SetId((int)0,(int)0);
aHexahedron.GetPointIds().SetId((int)1,(int)1);
aHexahedron.GetPointIds().SetId((int)2,(int)2);
aHexahedron.GetPointIds().SetId((int)3,(int)3);
aHexahedron.GetPointIds().SetId((int)4,(int)4);
aHexahedron.GetPointIds().SetId((int)5,(int)5);
aHexahedron.GetPointIds().SetId((int)6,(int)6);
aHexahedron.GetPointIds().SetId((int)7,(int)7);
aHexahedronGrid = new vtkUnstructuredGrid();
aHexahedronGrid.Allocate((int)1,(int)1);
aHexahedronGrid.InsertNextCell((int)aHexahedron.GetCellType(),(vtkIdList)aHexahedron.GetPointIds());
aHexahedronGrid.SetPoints((vtkPoints)hexahedronPoints);
aHexahedronMapper = new vtkDataSetMapper();
aHexahedronMapper.SetInput((vtkDataSet)aHexahedronGrid);
aHexahedronActor = new vtkActor();
aHexahedronActor.SetMapper((vtkMapper)aHexahedronMapper);
aHexahedronActor.AddPosition((double)2,(double)0,(double)0);
aHexahedronActor.GetProperty().BackfaceCullingOn();
// Tetra[]
tetraPoints = new vtkPoints();
tetraPoints.SetNumberOfPoints((int)4);
tetraPoints.InsertPoint((int)0,(double)0,(double)0,(double)0);
tetraPoints.InsertPoint((int)1,(double)1,(double)0,(double)0);
tetraPoints.InsertPoint((int)2,(double)0,(double)1,(double)0);
tetraPoints.InsertPoint((int)3,(double)1,(double)1,(double)1);
aTetra = new vtkTetra();
aTetra.GetPointIds().SetId((int)0,(int)0);
aTetra.GetPointIds().SetId((int)1,(int)1);
aTetra.GetPointIds().SetId((int)2,(int)2);
aTetra.GetPointIds().SetId((int)3,(int)3);
aTetraGrid = new vtkUnstructuredGrid();
aTetraGrid.Allocate((int)1,(int)1);
aTetraGrid.InsertNextCell((int)aTetra.GetCellType(),(vtkIdList)aTetra.GetPointIds());
aTetraGrid.SetPoints((vtkPoints)tetraPoints);
aTetraMapper = new vtkDataSetMapper();
aTetraMapper.SetInput((vtkDataSet)aTetraGrid);
aTetraActor = new vtkActor();
aTetraActor.SetMapper((vtkMapper)aTetraMapper);
aTetraActor.AddPosition((double)4,(double)0,(double)0);
aTetraActor.GetProperty().BackfaceCullingOn();
// Wedge[]
wedgePoints = new vtkPoints();
//.........这里部分代码省略.........
示例13: AVTestPolyDataPieces
/// <summary>
/// The main entry method called by the CSharp driver
/// </summary>
/// <param name="argv"></param>
public static void AVTestPolyDataPieces(String [] argv)
{
//Prefix Content is: ""
math = new vtkMath();
vtkMath.RandomSeed((int)22);
pf = new vtkParallelFactory();
vtkParallelFactory.RegisterFactory((vtkObjectFactory)pf);
sphere = new vtkSphereSource();
sphere.SetPhiResolution((int)32);
sphere.SetThetaResolution((int)32);
extract = new vtkExtractPolyDataPiece();
extract.SetInputConnection((vtkAlgorithmOutput)sphere.GetOutputPort());
normals = new vtkPolyDataNormals();
normals.SetInputConnection((vtkAlgorithmOutput)extract.GetOutputPort());
ps = new vtkPieceScalars();
ps.SetInputConnection((vtkAlgorithmOutput)normals.GetOutputPort());
mapper = vtkPolyDataMapper.New();
mapper.SetInputConnection((vtkAlgorithmOutput)ps.GetOutputPort());
mapper.SetNumberOfPieces((int)2);
actor = new vtkActor();
actor.SetMapper((vtkMapper)mapper);
sphere2 = new vtkSphereSource();
sphere2.SetPhiResolution((int)32);
sphere2.SetThetaResolution((int)32);
extract2 = new vtkExtractPolyDataPiece();
extract2.SetInputConnection((vtkAlgorithmOutput)sphere2.GetOutputPort());
mapper2 = vtkPolyDataMapper.New();
mapper2.SetInputConnection((vtkAlgorithmOutput)extract2.GetOutputPort());
mapper2.SetNumberOfPieces((int)2);
mapper2.SetPiece((int)1);
mapper2.SetScalarRange((double)0,(double)4);
mapper2.SetScalarModeToUseCellFieldData();
mapper2.SetColorModeToMapScalars();
mapper2.ColorByArrayComponent((string)"vtkGhostLevels",(int)0);
mapper2.SetGhostLevel((int)4);
// check the pipeline size[]
extract2.UpdateInformation();
psize = new vtkPipelineSize();
if ((psize.GetEstimatedSize((vtkAlgorithm)extract2,(int)0,(int)0)) > 100)
{
//puts skipedputs ['stderr', '"ERROR: Pipeline Size increased"']
}
if ((psize.GetNumberOfSubPieces((uint)10,(vtkPolyDataMapper)mapper2)) != 2)
{
//puts skipedputs ['stderr', '"ERROR: Number of sub pieces changed"']
}
actor2 = new vtkActor();
actor2.SetMapper((vtkMapper)mapper2);
actor2.SetPosition((double)1.5,(double)0,(double)0);
sphere3 = new vtkSphereSource();
sphere3.SetPhiResolution((int)32);
sphere3.SetThetaResolution((int)32);
extract3 = new vtkExtractPolyDataPiece();
extract3.SetInputConnection((vtkAlgorithmOutput)sphere3.GetOutputPort());
ps3 = new vtkPieceScalars();
ps3.SetInputConnection((vtkAlgorithmOutput)extract3.GetOutputPort());
mapper3 = vtkPolyDataMapper.New();
mapper3.SetInputConnection((vtkAlgorithmOutput)ps3.GetOutputPort());
mapper3.SetNumberOfSubPieces((int)8);
mapper3.SetScalarRange((double)0,(double)8);
actor3 = new vtkActor();
actor3.SetMapper((vtkMapper)mapper3);
actor3.SetPosition((double)0,(double)-1.5,(double)0);
sphere4 = new vtkSphereSource();
sphere4.SetPhiResolution((int)32);
sphere4.SetThetaResolution((int)32);
extract4 = new vtkExtractPolyDataPiece();
extract4.SetInputConnection((vtkAlgorithmOutput)sphere4.GetOutputPort());
ps4 = new vtkPieceScalars();
ps4.RandomModeOn();
ps4.SetScalarModeToCellData();
ps4.SetInputConnection((vtkAlgorithmOutput)extract4.GetOutputPort());
mapper4 = vtkPolyDataMapper.New();
mapper4.SetInputConnection((vtkAlgorithmOutput)ps4.GetOutputPort());
mapper4.SetNumberOfSubPieces((int)8);
mapper4.SetScalarRange((double)0,(double)8);
actor4 = new vtkActor();
actor4.SetMapper((vtkMapper)mapper4);
actor4.SetPosition((double)1.5,(double)-1.5,(double)0);
ren = vtkRenderer.New();
ren.AddActor((vtkProp)actor);
ren.AddActor((vtkProp)actor2);
ren.AddActor((vtkProp)actor3);
ren.AddActor((vtkProp)actor4);
renWin = vtkRenderWindow.New();
renWin.AddRenderer((vtkRenderer)ren);
iren = new vtkRenderWindowInteractor();
iren.SetRenderWindow((vtkRenderWindow)renWin);
iren.Initialize();
//deleteAllVTKObjects();
}
示例14: AVcombStreamers2
/// <summary>
/// The main entry method called by the CSharp driver
/// </summary>
/// <param name="argv"></param>
public static void AVcombStreamers2(String [] argv)
{
//Prefix Content is: ""
// Create the RenderWindow, Renderer and both Actors[]
//[]
ren1 = vtkRenderer.New();
renWin = vtkRenderWindow.New();
renWin.AddRenderer((vtkRenderer)ren1);
iren = new vtkRenderWindowInteractor();
iren.SetRenderWindow((vtkRenderWindow)renWin);
// create pipeline[]
//[]
pl3d = new vtkPLOT3DReader();
pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin");
pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin");
pl3d.SetScalarFunctionNumber((int)100);
pl3d.SetVectorFunctionNumber((int)202);
pl3d.Update();
ps = new vtkPlaneSource();
ps.SetXResolution((int)4);
ps.SetYResolution((int)4);
ps.SetOrigin((double)2,(double)-2,(double)26);
ps.SetPoint1((double)2,(double)2,(double)26);
ps.SetPoint2((double)2,(double)-2,(double)32);
psMapper = vtkPolyDataMapper.New();
psMapper.SetInputConnection((vtkAlgorithmOutput)ps.GetOutputPort());
psActor = new vtkActor();
psActor.SetMapper((vtkMapper)psMapper);
psActor.GetProperty().SetRepresentationToWireframe();
streamer = new vtkDashedStreamLine();
streamer.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort());
streamer.SetSource((vtkDataSet)ps.GetOutput());
streamer.SetMaximumPropagationTime((double)100);
streamer.SetIntegrationStepLength((double).2);
streamer.SetStepLength((double).001);
streamer.SetNumberOfThreads((int)1);
streamer.SetIntegrationDirectionToForward();
streamMapper = vtkPolyDataMapper.New();
streamMapper.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
streamMapper.SetScalarRange(
(double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0],
(double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]);
streamline = new vtkActor();
streamline.SetMapper((vtkMapper)streamMapper);
outline = new vtkStructuredGridOutlineFilter();
outline.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort());
outlineMapper = vtkPolyDataMapper.New();
outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
outlineActor = new vtkActor();
outlineActor.SetMapper((vtkMapper)outlineMapper);
// Add the actors to the renderer, set the background and size[]
//[]
ren1.AddActor((vtkProp)psActor);
ren1.AddActor((vtkProp)outlineActor);
ren1.AddActor((vtkProp)streamline);
ren1.SetBackground((double)1,(double)1,(double)1);
renWin.SetSize((int)300,(int)300);
ren1.SetBackground((double)0.1,(double)0.2,(double)0.4);
cam1 = ren1.GetActiveCamera();
cam1.SetClippingRange((double)3.95297,(double)50);
cam1.SetFocalPoint((double)9.71821,(double)0.458166,(double)29.3999);
cam1.SetPosition((double)2.7439,(double)-37.3196,(double)38.7167);
cam1.SetViewUp((double)-0.16123,(double)0.264271,(double)0.950876);
// render the image[]
//[]
renWin.Render();
// prevent the tk window from showing up then start the event loop[]
//deleteAllVTKObjects();
}
示例15: Main
static void Main(string[] args)
{
// create a sphere source, mapper, and actor
vtkSphereSource sphere = new vtkSphereSource();
vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();
sphereMapper.SetInputConnection(sphere.GetOutputPort());
vtkPolyDataMapper.GlobalImmediateModeRenderingOn();
vtkLODActor sphereActor = new vtkLODActor();
sphereActor.SetMapper(sphereMapper);
// create the spikes by glyphing the sphere with a cone. Create the
// mapper and actor for the glyphs.
vtkConeSource cone = new vtkConeSource();
vtkGlyph3D glyph = new vtkGlyph3D();
glyph.SetInputConnection(sphere.GetOutputPort());
glyph.SetSource(cone.GetOutput());
glyph.SetVectorModeToUseNormal();
glyph.SetScaleModeToScaleByVector();
glyph.SetScaleFactor(0.25);
vtkPolyDataMapper spikeMapper = new vtkPolyDataMapper();
spikeMapper.SetInputConnection(glyph.GetOutputPort());
vtkLODActor spikeActor = new vtkLODActor();
spikeActor.SetMapper(spikeMapper);
// Create a text mapper and actor to display the results of picking.
vtkTextMapper textMapper = new vtkTextMapper();
vtkTextProperty tprop = textMapper.GetTextProperty();
tprop.SetFontFamilyToArial();
tprop.SetFontSize(10);
tprop.BoldOn();
tprop.ShadowOn();
tprop.SetColor(1, 0, 0);
vtkActor2D textActor = new vtkActor2D();
textActor.VisibilityOff();
textActor.SetMapper(textMapper);
// Create a cell picker.
vtkCellPicker picker = new vtkCellPicker();
PickData pd = new PickData();
pd.textActor = textActor;
pd.textMapper = textMapper;
vtkDotNetCallback cb = new vtkDotNetCallback(pd.annotatePickCallback);
// Now at the end of the pick event call the above function.
picker.AddObserver((uint) EventIds.EndPickEvent, cb);
// Create the Renderer, RenderWindow, etc. and set the Picker.
vtkRenderer ren = new vtkRenderer();
vtkRenderWindow renWin = new vtkRenderWindow();
renWin.AddRenderer(ren);
vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();
iren.SetRenderWindow(renWin);
iren.SetPicker(picker);
// Add the actors to the renderer, set the background and size
ren.AddActor2D(textActor);
ren.AddActor(sphereActor);
ren.AddActor(spikeActor);
ren.SetBackground(1, 1, 1);
renWin.SetSize(300, 300);
// Get the camera and zoom in closer to the image.
ren.ResetCamera();
vtkCamera cam1 = ren.GetActiveCamera();
cam1.Zoom(1.4);
iren.Initialize();
// Initially pick the cell at this location.
picker.Pick(85, 126, 0, ren);
renWin.Render();
iren.Start();
vtkWin32OpenGLRenderWindow win32win =
vtkWin32OpenGLRenderWindow.SafeDownCast(renWin);
if (null != win32win) win32win.Clean();
}