本文整理汇总了C#中vtkRenderWindowInteractor类的典型用法代码示例。如果您正苦于以下问题:C# vtkRenderWindowInteractor类的具体用法?C# vtkRenderWindowInteractor怎么用?C# vtkRenderWindowInteractor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
vtkRenderWindowInteractor类属于命名空间,在下文中一共展示了vtkRenderWindowInteractor类的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: AVpickCells
/// <summary>
/// The main entry method called by the CSharp driver
/// </summary>
/// <param name="argv"></param>
public static void AVpickCells(String [] argv)
{
//Prefix Content is: ""
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).5,(double)1,(double)0);
tetraPoints.InsertPoint((int)3,(double).5,(double).5,(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();
wedgePoints.SetNumberOfPoints((int)6);
wedgePoints.InsertPoint((int)0,(double)0,(double)1,(double)0);
wedgePoints.InsertPoint((int)1,(double)0,(double)0,(double)0);
//.........这里部分代码省略.........
示例8: 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();
}
示例9: AVtextureThreshold
/// <summary>
/// The main entry method called by the CSharp driver
/// </summary>
/// <param name="argv"></param>
public static void AVtextureThreshold(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/bluntfinxyz.bin");
pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/bluntfinq.bin");
pl3d.SetScalarFunctionNumber((int)100);
pl3d.SetVectorFunctionNumber((int)202);
pl3d.Update();
// wall[]
//[]
wall = new vtkStructuredGridGeometryFilter();
wall.SetInputData(pl3d.GetOutput().GetBlock(0));
wall.SetExtent((int)0,(int)100,(int)0,(int)0,(int)0,(int)100);
wallMap = vtkPolyDataMapper.New();
wallMap.SetInputConnection((vtkAlgorithmOutput)wall.GetOutputPort());
wallMap.ScalarVisibilityOff();
wallActor = new vtkActor();
wallActor.SetMapper((vtkMapper)wallMap);
wallActor.GetProperty().SetColor((double)0.8,(double)0.8,(double)0.8);
// fin[]
// []
fin = new vtkStructuredGridGeometryFilter();
fin.SetInputData(pl3d.GetOutput().GetBlock(0));
fin.SetExtent((int)0,(int)100,(int)0,(int)100,(int)0,(int)0);
finMap = vtkPolyDataMapper.New();
finMap.SetInputConnection((vtkAlgorithmOutput)fin.GetOutputPort());
finMap.ScalarVisibilityOff();
finActor = new vtkActor();
finActor.SetMapper((vtkMapper)finMap);
finActor.GetProperty().SetColor((double)0.8,(double)0.8,(double)0.8);
// planes to threshold[]
tmap = new vtkStructuredPointsReader();
tmap.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/texThres2.vtk");
texture = new vtkTexture();
texture.SetInputConnection((vtkAlgorithmOutput)tmap.GetOutputPort());
texture.InterpolateOff();
texture.RepeatOff();
plane1 = new vtkStructuredGridGeometryFilter();
plane1.SetInputData(pl3d.GetOutput().GetBlock(0));
plane1.SetExtent((int)10,(int)10,(int)0,(int)100,(int)0,(int)100);
thresh1 = new vtkThresholdTextureCoords();
thresh1.SetInputConnection((vtkAlgorithmOutput)plane1.GetOutputPort());
thresh1.ThresholdByUpper((double)1.5);
plane1Map = new vtkDataSetMapper();
plane1Map.SetInputConnection((vtkAlgorithmOutput)thresh1.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.SetTexture((vtkTexture)texture);
plane1Actor.GetProperty().SetOpacity((double)0.999);
plane2 = new vtkStructuredGridGeometryFilter();
plane2.SetInputData(pl3d.GetOutput().GetBlock(0));
plane2.SetExtent((int)30,(int)30,(int)0,(int)100,(int)0,(int)100);
thresh2 = new vtkThresholdTextureCoords();
thresh2.SetInputConnection((vtkAlgorithmOutput)plane2.GetOutputPort());
thresh2.ThresholdByLower((double)1.5);
plane2Map = new vtkDataSetMapper();
plane2Map.SetInputConnection((vtkAlgorithmOutput)thresh2.GetOutputPort());
plane2Map.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
(double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
plane2Actor = new vtkActor();
plane2Actor.SetMapper((vtkMapper)plane2Map);
plane2Actor.SetTexture((vtkTexture)texture);
plane2Actor.GetProperty().SetOpacity((double)0.999);
plane3 = new vtkStructuredGridGeometryFilter();
plane3.SetInputData(pl3d.GetOutput().GetBlock(0));
plane3.SetExtent((int)35,(int)35,(int)0,(int)100,(int)0,(int)100);
thresh3 = new vtkThresholdTextureCoords();
thresh3.SetInputConnection((vtkAlgorithmOutput)plane3.GetOutputPort());
thresh3.ThresholdBetween((double)1.5,(double)1.8);
plane3Map = new vtkDataSetMapper();
plane3Map.SetInputConnection((vtkAlgorithmOutput)thresh3.GetOutputPort());
plane3Map.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
(double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
plane3Actor = new vtkActor();
plane3Actor.SetMapper((vtkMapper)plane3Map);
plane3Actor.SetTexture((vtkTexture)texture);
plane3Actor.GetProperty().SetOpacity((double)0.999);
// outline[]
outline = new vtkStructuredGridOutlineFilter();
outline.SetInputData(pl3d.GetOutput().GetBlock(0));
outlineMapper = vtkPolyDataMapper.New();
outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
outlineActor = new vtkActor();
//.........这里部分代码省略.........
示例10: AVmergeFilter
/// <summary>
/// The main entry method called by the CSharp driver
/// </summary>
/// <param name="argv"></param>
public static void AVmergeFilter(String [] argv)
{
//Prefix Content is: ""
// Create the RenderWindow, Renderer and both Actors[]
//[]
ren1 = vtkRenderer.New();
ren2 = vtkRenderer.New();
renWin = vtkRenderWindow.New();
renWin.AddRenderer((vtkRenderer)ren1);
renWin.AddRenderer((vtkRenderer)ren2);
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)110);
pl3d.SetVectorFunctionNumber((int)202);
pl3d.Update();
probeLine = new vtkLineSource();
probeLine.SetPoint1((double)1,(double)1,(double)29);
probeLine.SetPoint2((double)16.5,(double)5,(double)31.7693);
probeLine.SetResolution((int)500);
probe = new vtkProbeFilter();
probe.SetInputConnection((vtkAlgorithmOutput)probeLine.GetOutputPort());
probe.SetSource((vtkDataObject)pl3d.GetOutput());
probeTube = new vtkTubeFilter();
probeTube.SetInput((vtkDataObject)probe.GetPolyDataOutput());
probeTube.SetNumberOfSides((int)5);
probeTube.SetRadius((double).05);
probeMapper = vtkPolyDataMapper.New();
probeMapper.SetInputConnection((vtkAlgorithmOutput)probeTube.GetOutputPort());
probeMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0],
(double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]);
probeActor = new vtkActor();
probeActor.SetMapper((vtkMapper)probeMapper);
displayLine = new vtkLineSource();
displayLine.SetPoint1((double)0,(double)0,(double)0);
displayLine.SetPoint2((double)1,(double)0,(double)0);
displayLine.SetResolution((int)probeLine.GetResolution());
displayMerge = new vtkMergeFilter();
displayMerge.SetGeometry((vtkDataSet)displayLine.GetOutput());
displayMerge.SetScalars((vtkDataSet)probe.GetPolyDataOutput());
displayWarp = new vtkWarpScalar();
displayWarp.SetInput((vtkDataObject)displayMerge.GetPolyDataOutput());
displayWarp.SetNormal((double)0,(double)1,(double)0);
displayWarp.SetScaleFactor((double).000001);
displayMapper = vtkPolyDataMapper.New();
displayMapper.SetInput((vtkPolyData)displayWarp.GetPolyDataOutput());
displayMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0],
(double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]);
displayActor = new vtkActor();
displayActor.SetMapper((vtkMapper)displayMapper);
outline = new vtkStructuredGridOutlineFilter();
outline.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort());
outlineMapper = vtkPolyDataMapper.New();
outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
outlineActor = new vtkActor();
outlineActor.SetMapper((vtkMapper)outlineMapper);
outlineActor.GetProperty().SetColor((double)0,(double)0,(double)0);
ren1.AddActor((vtkProp)outlineActor);
ren1.AddActor((vtkProp)probeActor);
ren1.SetBackground((double)1,(double)1,(double)1);
ren1.SetViewport((double)0,(double).25,(double)1,(double)1);
ren2.AddActor((vtkProp)displayActor);
ren2.SetBackground((double)0,(double)0,(double)0);
ren2.SetViewport((double)0,(double)0,(double)1,(double).25);
renWin.SetSize((int)300,(int)300);
ren1.ResetCamera();
cam1 = ren1.GetActiveCamera();
cam1.SetClippingRange((double)3.95297,(double)50);
cam1.SetFocalPoint((double)8.88908,(double)0.595038,(double)29.3342);
cam1.SetPosition((double)9.9,(double)-26,(double)41);
cam1.SetViewUp((double)0.060772,(double)-0.319905,(double)0.945498);
ren2.ResetCamera();
cam2 = ren2.GetActiveCamera();
cam2.ParallelProjectionOn();
cam2.SetParallelScale((double).15);
iren.Initialize();
// render the image[]
//[]
// prevent the tk window from showing up then start the event loop[]
//deleteAllVTKObjects();
}
示例11: c3DWorld
//public c3DWorld(Kitware.VTK.RenderWindowControl CurrentrenderWindowControl, Sequence Seq)
//{
// this.ren1 = CurrentrenderWindowControl.RenderWindow.GetRenderers().GetFirstRenderer();
// this.renWin = CurrentrenderWindowControl.RenderWindow;
// if (Seq == null)
// {
// Xres = Yres = Zres = 0;
// }
// else
// {
// Xres = Seq.XResolution;
// Yres = Seq.YResolution;
// Zres = Seq.ZResolution;
// }
// ListPolyDataMapper = new List<vtkPolyDataMapper>();
// ListObject = new List<cObject3D>();
// ListVolume = new List<cVolume3D>();
//}
/// <summary>
/// Create a 3D world
/// </summary>
/// <param name="CurrentrenderWindowControl">vtk Control</param>
/// <param name="Dimensions">in pixels</param>
/// <param name="Resolution">spatial resolutions</param>
public c3DWorld(cPoint3D Dimensions, cPoint3D Resolution, RenderWindowControl CurrentrenderWindowControl, int[] WinPos)
{
// int[] Pos = renWin.GetPosition();
//,
if (CurrentrenderWindowControl == null)
{
renWin = vtkRenderWindow.New();
renWin.LineSmoothingOn();
renWin.PointSmoothingOn();
renWin.SetWindowName("3D World");
renWin.BordersOn();
renWin.DoubleBufferOn();
renWin.SetSize(750, 500);
// if(WinPos!=null) renWin.SetPosition(WinPos[0], WinPos[1]);
// this.ren1 = CurrentrenderWindowControl.RenderWindow.GetRenderers().GetFirstRenderer();
//CurrentrenderWindowControl.RenderWindow;
}
//// Menu Strip Construction
//this.contextMenuStripActorPicker = new ContextMenuStrip();
//ToolStripMenuItem StripMenuItemDisplay = new ToolStripMenuItem("Display");
//contextMenuStripActorPicker.Items.Add(StripMenuItemDisplay);
this.ren1 = vtkRenderer.New();
//renWin = CurrentrenderWindowControl.RenderWindow;//vtkRenderWindow.New();
renWin.AddRenderer(ren1);
iren = new vtkRenderWindowInteractor();
iren.SetRenderWindow(renWin);
//iren.SetInteractorStyle(vtkInteractorStyleJoystickCamera.New());
iren.SetInteractorStyle(vtkInteractorStyleTrackballCamera.New());
// iren.SetInteractorStyle(vtkInteractorStyleTerrain.New());
// iren.LeftButtonPressEvt += new vtkObject.vtkObjectEventHandler(RenderWindow_LeftButtonPressEvt);
iren.KeyPressEvt += new vtkObject.vtkObjectEventHandler(RenderWindow_KeyPressEvt);
iren.RightButtonPressEvt += new vtkObject.vtkObjectEventHandler(RenderWindow_RightButtonPressEvt);
//Render();
//this.ren1 =
Xres = Resolution.X;
Yres = Resolution.Y;
Zres = Resolution.Z;
SizeX = (int)Dimensions.X;
SizeY = (int)Dimensions.Y;
SizeZ = (int)Dimensions.Z;
// double[] fp = ren1.GetActiveCamera().GetFocalPoint();
// double[] p = ren1.GetActiveCamera().GetPosition();
// ren1.GetActiveCamera().ParallelProjectionOn();
// double dist = Math.Sqrt((p[0] - fp[0]) * (p[0] - fp[0]) + (p[1] - fp[1]) * (p[1] - fp[1]) + (p[2] - fp[2]) * (p[2] - fp[2]));
// ren1.GetActiveCamera().SetPosition(fp[0], fp[1], fp[2] + dist*1000);
// ren1.GetActiveCamera().Zoom(2);
//ren1.Render();
// this.Render();
ListPolyDataMapper = new List<vtkPolyDataMapper>();
ListObject = new List<cObject3D>();
// Vtk_CameraViewOrientation = ren1.GetActiveCamera();
}
示例12: 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();
}
示例13: Setiren
///<summary> A Set Method for Static Variables </summary>
public static void Setiren(vtkRenderWindowInteractor toSet)
{
iren = toSet;
}
示例14: 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);
//.........这里部分代码省略.........
示例15: AVstreamTracer
/// <summary>
/// The main entry method called by the CSharp driver
/// </summary>
/// <param name="argv"></param>
public static void AVstreamTracer(String [] argv)
{
//Prefix Content is: ""
ren1 = vtkRenderer.New();
renWin = vtkRenderWindow.New();
// this test has some wireframe geometry
// Make sure multisampling is disabled to avoid generating multiple
// regression images
// renWin SetMultiSamples 0
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[]
outline = new vtkStructuredGridOutlineFilter();
outline.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
mapOutline = vtkPolyDataMapper.New();
mapOutline.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
outlineActor = new vtkActor();
outlineActor.SetMapper((vtkMapper)mapOutline);
outlineActor.GetProperty().SetColor((double)0,(double)0,(double)0);
rk = new vtkRungeKutta45();
// Create source for streamtubes[]
streamer = new vtkStreamTracer();
streamer.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
streamer.SetStartPosition((double)0.1,(double)2.1,(double)0.5);
streamer.SetMaximumPropagation((double)500);
streamer.SetIntegrationStepUnit(2);
streamer.SetMinimumIntegrationStep((double)0.1);
streamer.SetMaximumIntegrationStep((double)1.0);
streamer.SetInitialIntegrationStep((double)0.2);
streamer.SetIntegrationDirection((int)0);
streamer.SetIntegrator((vtkInitialValueProblemSolver)rk);
streamer.SetRotationScale((double)0.5);
streamer.SetMaximumError((double)1.0e-8);
aa = new vtkAssignAttribute();
aa.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
aa.Assign((string)"Normals",(string)"NORMALS",(string)"POINT_DATA");
rf1 = new vtkRibbonFilter();
rf1.SetInputConnection((vtkAlgorithmOutput)aa.GetOutputPort());
rf1.SetWidth((double)0.1);
rf1.VaryWidthOff();
mapStream = vtkPolyDataMapper.New();
mapStream.SetInputConnection((vtkAlgorithmOutput)rf1.GetOutputPort());
mapStream.SetScalarRange((double)((vtkDataSet)reader.GetOutput()).GetScalarRange()[0],(double)((vtkDataSet)reader.GetOutput()).GetScalarRange()[1]);
streamActor = new vtkActor();
streamActor.SetMapper((vtkMapper)mapStream);
ren1.AddActor((vtkProp)outlineActor);
ren1.AddActor((vtkProp)streamActor);
ren1.SetBackground((double)0.4,(double)0.4,(double)0.5);
cam = ren1.GetActiveCamera();
cam.SetPosition((double)-2.35599,(double)-3.35001,(double)4.59236);
cam.SetFocalPoint((double)2.255,(double)2.255,(double)1.28413);
cam.SetViewUp((double)0.311311,(double)0.279912,(double)0.908149);
cam.SetClippingRange((double)1.12294,(double)16.6226);
renWin.SetSize((int)300,(int)200);
iren.Initialize();
// interact with data[]
//deleteAllVTKObjects();
}