本文整理汇总了C#中vtkRenderWindow.SetSize方法的典型用法代码示例。如果您正苦于以下问题:C# vtkRenderWindow.SetSize方法的具体用法?C# vtkRenderWindow.SetSize怎么用?C# vtkRenderWindow.SetSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vtkRenderWindow
的用法示例。
在下文中一共展示了vtkRenderWindow.SetSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: 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();
}
示例4: 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();
}
示例5: AVEnSightRectGridASCII
//.........这里部分代码省略.........
reader.SetCaseFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/EnSight/RectGrid_ascii.case");
reader.Update();
toRectilinearGrid = new vtkCastToConcrete();
// toRectilinearGrid SetInputConnection [reader GetOutputPort] []
toRectilinearGrid.SetInput((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
plane = new vtkRectilinearGridGeometryFilter();
plane.SetInput((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
plane.SetExtent((int)0,(int)100,(int)0,(int)100,(int)15,(int)15);
tri = new vtkTriangleFilter();
tri.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
warper = new vtkWarpVector();
warper.SetInputConnection((vtkAlgorithmOutput)tri.GetOutputPort());
warper.SetScaleFactor((double)0.05);
planeMapper = new vtkDataSetMapper();
planeMapper.SetInputConnection((vtkAlgorithmOutput)warper.GetOutputPort());
planeMapper.SetScalarRange((double)0.197813,(double)0.710419);
planeActor = new vtkActor();
planeActor.SetMapper((vtkMapper)planeMapper);
cutPlane = new vtkPlane();
// eval cutPlane SetOrigin [[reader GetOutput] GetCenter][]
cutPlane.SetOrigin((double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetCenter()[0], (double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetCenter()[1], (double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetCenter()[2]);
cutPlane.SetNormal((double)1,(double)0,(double)0);
planeCut = new vtkCutter();
planeCut.SetInput((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
planeCut.SetCutFunction((vtkImplicitFunction)cutPlane);
cutMapper = new vtkDataSetMapper();
cutMapper.SetInputConnection((vtkAlgorithmOutput)planeCut.GetOutputPort());
cutMapper.SetScalarRange((double)((vtkDataSet)((vtkMultiBlockDataSet)reader.GetOutput()).GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[0], (double)((vtkDataSet)((vtkMultiBlockDataSet)reader.GetOutput()).GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[1]);
cutActor = new vtkActor();
cutActor.SetMapper((vtkMapper)cutMapper);
iso = new vtkContourFilter();
iso.SetInput((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
iso.SetValue((int)0,(double)0.7);
normals = new vtkPolyDataNormals();
normals.SetInputConnection((vtkAlgorithmOutput)iso.GetOutputPort());
normals.SetFeatureAngle((double)45);
isoMapper = vtkPolyDataMapper.New();
isoMapper.SetInputConnection((vtkAlgorithmOutput)normals.GetOutputPort());
isoMapper.ScalarVisibilityOff();
isoActor = new vtkActor();
isoActor.SetMapper((vtkMapper)isoMapper);
isoActor.GetProperty().SetColor((double) 1.0000, 0.8941, 0.7686 );
isoActor.GetProperty().SetRepresentationToWireframe();
streamer = new vtkStreamLine();
// streamer SetInputConnection [reader GetOutputPort][]
streamer.SetInput((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
streamer.SetStartPosition((double)-1.2,(double)-0.1,(double)1.3);
streamer.SetMaximumPropagationTime((double)500);
streamer.SetStepLength((double)0.05);
streamer.SetIntegrationStepLength((double)0.05);
streamer.SetIntegrationDirectionToIntegrateBothDirections();
streamTube = new vtkTubeFilter();
streamTube.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
streamTube.SetRadius((double)0.025);
streamTube.SetNumberOfSides((int)6);
streamTube.SetVaryRadius((int)VTK_VARY_RADIUS_BY_VECTOR);
mapStreamTube = vtkPolyDataMapper.New();
mapStreamTube.SetInputConnection((vtkAlgorithmOutput)streamTube.GetOutputPort());
mapStreamTube.SetScalarRange((double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[0], (double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[1]);
// [[[[reader GetOutput] GetPointData] GetScalars] GetRange][]
streamTubeActor = new vtkActor();
streamTubeActor.SetMapper((vtkMapper)mapStreamTube);
streamTubeActor.GetProperty().BackfaceCullingOn();
outline = new vtkOutlineFilter();
outline.SetInput((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
outlineMapper = vtkPolyDataMapper.New();
outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
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.AddActor((vtkProp)planeActor);
ren1.AddActor((vtkProp)cutActor);
ren1.AddActor((vtkProp)isoActor);
ren1.AddActor((vtkProp)streamTubeActor);
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[]
vtkGenericEnSightReader.SetDefaultExecutivePrototype(null);
//deleteAllVTKObjects();
}
示例6: AVcursor3D
/// <summary>
/// The main entry method called by the CSharp driver
/// </summary>
/// <param name="argv"></param>
public static void AVcursor3D(String [] argv)
{
//Prefix Content is: ""
// This little example shows how a cursor can be created in []
// image viewers, and renderers. The standard TkImageViewerWidget and[]
// TkRenderWidget bindings are used. There is a new binding:[]
// middle button in the image viewer sets the position of the cursor. []
// First we include the VTK Tcl packages which will make available []
// all of the vtk commands to Tcl[]
// Global values[]
CURSOR_X = 20;
CURSOR_Y = 20;
CURSOR_Z = 20;
IMAGE_MAG_X = 4;
IMAGE_MAG_Y = 4;
IMAGE_MAG_Z = 1;
// Pipeline stuff[]
reader = new vtkSLCReader();
reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/neghip.slc");
// Cursor stuff[]
magnify = new vtkImageMagnify();
magnify.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
magnify.SetMagnificationFactors((int)IMAGE_MAG_X,(int)IMAGE_MAG_Y,(int)IMAGE_MAG_Z);
image_cursor = new vtkImageCursor3D();
image_cursor.SetInputConnection((vtkAlgorithmOutput)magnify.GetOutputPort());
image_cursor.SetCursorPosition((double)CURSOR_X*IMAGE_MAG_X,(double)CURSOR_Y*IMAGE_MAG_Y,(double)CURSOR_Z*IMAGE_MAG_Z);
image_cursor.SetCursorValue((double)255);
image_cursor.SetCursorRadius((int)50*IMAGE_MAG_X);
axes = new vtkAxes();
axes.SymmetricOn();
axes.SetOrigin((double)CURSOR_X,(double)CURSOR_Y,(double)CURSOR_Z);
axes.SetScaleFactor((double)50.0);
axes_mapper = vtkPolyDataMapper.New();
axes_mapper.SetInputConnection((vtkAlgorithmOutput)axes.GetOutputPort());
axesActor = new vtkActor();
axesActor.SetMapper((vtkMapper)axes_mapper);
axesActor.GetProperty().SetAmbient((double)0.5);
// Image viewer stuff[]
viewer = new vtkImageViewer();
viewer.SetInputConnection((vtkAlgorithmOutput)image_cursor.GetOutputPort());
viewer.SetZSlice((int)CURSOR_Z*IMAGE_MAG_Z);
viewer.SetColorWindow((double)256);
viewer.SetColorLevel((double)128);
//method moved
//method moved
//method moved
// Create transfer functions for opacity and color[]
opacity_transfer_function = new vtkPiecewiseFunction();
opacity_transfer_function.AddPoint((double)20,(double)0.0);
opacity_transfer_function.AddPoint((double)255,(double)0.2);
color_transfer_function = new vtkColorTransferFunction();
color_transfer_function.AddRGBPoint((double)0,(double)0,(double)0,(double)0);
color_transfer_function.AddRGBPoint((double)64,(double)1,(double)0,(double)0);
color_transfer_function.AddRGBPoint((double)128,(double)0,(double)0,(double)1);
color_transfer_function.AddRGBPoint((double)192,(double)0,(double)1,(double)0);
color_transfer_function.AddRGBPoint((double)255,(double)0,(double).2,(double)0);
// Create properties, mappers, volume actors, and ray cast function[]
volume_property = new vtkVolumeProperty();
volume_property.SetColor((vtkColorTransferFunction)color_transfer_function);
volume_property.SetScalarOpacity((vtkPiecewiseFunction)opacity_transfer_function);
composite_function = new vtkVolumeRayCastCompositeFunction();
volume_mapper = new vtkVolumeRayCastMapper();
volume_mapper.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
volume_mapper.SetVolumeRayCastFunction((vtkVolumeRayCastFunction)composite_function);
volume = new vtkVolume();
volume.SetMapper((vtkAbstractVolumeMapper)volume_mapper);
volume.SetProperty((vtkVolumeProperty)volume_property);
// Create outline[]
outline = new vtkOutlineFilter();
outline.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
outline_mapper = vtkPolyDataMapper.New();
outline_mapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
outlineActor = new vtkActor();
outlineActor.SetMapper((vtkMapper)outline_mapper);
outlineActor.GetProperty().SetColor((double)1,(double)1,(double)1);
// Create the renderer[]
ren1 = vtkRenderer.New();
ren1.AddActor((vtkProp)axesActor);
ren1.AddVolume((vtkProp)volume);
ren1.SetBackground((double)0.1,(double)0.2,(double)0.4);
renWin2 = vtkRenderWindow.New();
renWin2.AddRenderer((vtkRenderer)ren1);
renWin2.SetSize((int)256,(int)256);
// Create the GUI: two renderer widgets and a quit button[]
//tk window skipped..
// Set the window manager (wm command) so that it registers a[]
// command to handle the WM_DELETE_WINDOW protocal request. This[]
// request is triggered when the widget is closed using the standard[]
// window manager icons or buttons. In this case the exit callback[]
// will be called and it will free up any objects we created then exit[]
// the application.[]
// Help label, frame and quit button[]
//tk window skipped..
//tk window skipped..
//tk window skipped..
//.........这里部分代码省略.........
示例7: AVExtractTensors
/// <summary>
/// The main entry method called by the CSharp driver
/// </summary>
/// <param name="argv"></param>
public static void AVExtractTensors(String [] argv)
{
//Prefix Content is: ""
// create tensor ellipsoids[]
// Create the RenderWindow, Renderer and interactive renderer[]
//[]
ren1 = vtkRenderer.New();
renWin = vtkRenderWindow.New();
renWin.AddRenderer((vtkRenderer)ren1);
iren = new vtkRenderWindowInteractor();
iren.SetRenderWindow((vtkRenderWindow)renWin);
ptLoad = new vtkPointLoad();
ptLoad.SetLoadValue((double)100.0);
ptLoad.SetSampleDimensions((int)30,(int)30,(int)30);
ptLoad.ComputeEffectiveStressOn();
ptLoad.SetModelBounds((double)-10,(double)10,(double)-10,(double)10,(double)-10,(double)10);
extractTensor = new vtkExtractTensorComponents();
extractTensor.SetInputConnection((vtkAlgorithmOutput)ptLoad.GetOutputPort());
extractTensor.ScalarIsEffectiveStress();
extractTensor.ScalarIsComponent();
extractTensor.ExtractScalarsOn();
extractTensor.ExtractVectorsOn();
extractTensor.ExtractNormalsOff();
extractTensor.ExtractTCoordsOn();
contour = new vtkContourFilter();
contour.SetInputConnection((vtkAlgorithmOutput)extractTensor.GetOutputPort());
contour.SetValue((int)0,(double)0);
probe = new vtkProbeFilter();
probe.SetInputConnection((vtkAlgorithmOutput)contour.GetOutputPort());
probe.SetSource((vtkDataObject)ptLoad.GetOutput());
su = new vtkLoopSubdivisionFilter();
su.SetInputConnection((vtkAlgorithmOutput)probe.GetOutputPort());
su.SetNumberOfSubdivisions((int)1);
s1Mapper = vtkPolyDataMapper.New();
s1Mapper.SetInputConnection((vtkAlgorithmOutput)probe.GetOutputPort());
// s1Mapper SetInputConnection [su GetOutputPort][]
s1Actor = new vtkActor();
s1Actor.SetMapper((vtkMapper)s1Mapper);
//[]
// plane for context[]
//[]
g = new vtkImageDataGeometryFilter();
g.SetInputConnection((vtkAlgorithmOutput)ptLoad.GetOutputPort());
g.SetExtent((int)0,(int)100,(int)0,(int)100,(int)0,(int)0);
g.Update();
//for scalar range[]
gm = vtkPolyDataMapper.New();
gm.SetInputConnection((vtkAlgorithmOutput)g.GetOutputPort());
gm.SetScalarRange((double)((vtkDataSet)g.GetOutput()).GetScalarRange()[0],(double)((vtkDataSet)g.GetOutput()).GetScalarRange()[1]);
ga = new vtkActor();
ga.SetMapper((vtkMapper)gm);
s1Mapper.SetScalarRange((double)((vtkDataSet)g.GetOutput()).GetScalarRange()[0],(double)((vtkDataSet)g.GetOutput()).GetScalarRange()[1]);
//[]
// Create outline around data[]
//[]
outline = new vtkOutlineFilter();
outline.SetInputConnection((vtkAlgorithmOutput)ptLoad.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);
//[]
// Create cone indicating application of load[]
//[]
coneSrc = new vtkConeSource();
coneSrc.SetRadius((double).5);
coneSrc.SetHeight((double)2);
coneMap = vtkPolyDataMapper.New();
coneMap.SetInputConnection((vtkAlgorithmOutput)coneSrc.GetOutputPort());
coneActor = new vtkActor();
coneActor.SetMapper((vtkMapper)coneMap);
coneActor.SetPosition((double)0,(double)0,(double)11);
coneActor.RotateY((double)90);
coneActor.GetProperty().SetColor((double)1,(double)0,(double)0);
camera = new vtkCamera();
camera.SetFocalPoint((double)0.113766,(double)-1.13665,(double)-1.01919);
camera.SetPosition((double)-29.4886,(double)-63.1488,(double)26.5807);
camera.SetViewAngle((double)24.4617);
camera.SetViewUp((double)0.17138,(double)0.331163,(double)0.927879);
camera.SetClippingRange((double)1,(double)100);
ren1.AddActor((vtkProp)s1Actor);
ren1.AddActor((vtkProp)outlineActor);
ren1.AddActor((vtkProp)coneActor);
ren1.AddActor((vtkProp)ga);
ren1.SetBackground((double)1.0,(double)1.0,(double)1.0);
ren1.SetActiveCamera((vtkCamera)camera);
renWin.SetSize((int)300,(int)300);
renWin.Render();
// prevent the tk window from showing up then start the event loop[]
//deleteAllVTKObjects();
}
示例8: 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();
}
示例9: AVgeomFilter
//.........这里部分代码省略.........
gf4.SetCellMinimum((int)0);
gf4.SetCellMaximum((int)7500);
g4Mapper = vtkPolyDataMapper.New();
g4Mapper.SetInputConnection((vtkAlgorithmOutput)gf4.GetOutputPort());
g4Mapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0],
(double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]);
g4Actor = new vtkActor();
g4Actor.SetMapper((vtkMapper)g4Mapper);
g4Actor.AddPosition((double)0,(double)15,(double)15);
// create pipeline - unstructured grid[]
//[]
s = new vtkSphere();
s.SetCenter(pl3d.GetOutput().GetCenter()[0],pl3d.GetOutput().GetCenter()[1],pl3d.GetOutput().GetCenter()[2]);
s.SetRadius((double)100.0);
//everything[]
eg = new vtkExtractGeometry();
eg.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort());
eg.SetImplicitFunction((vtkImplicitFunction)s);
gf5 = new vtkGeometryFilter();
gf5.SetInputConnection((vtkAlgorithmOutput)eg.GetOutputPort());
g5Mapper = vtkPolyDataMapper.New();
g5Mapper.SetInputConnection((vtkAlgorithmOutput)gf5.GetOutputPort());
g5Mapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0],
(double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]);
g5Actor = new vtkActor();
g5Actor.SetMapper((vtkMapper)g5Mapper);
g5Actor.AddPosition((double)0,(double)0,(double)30);
gf6 = new vtkGeometryFilter();
gf6.SetInputConnection((vtkAlgorithmOutput)eg.GetOutputPort());
gf6.ExtentClippingOn();
gf6.SetExtent((double)10,(double)17,(double)-6,(double)6,(double)23,(double)37);
gf6.PointClippingOn();
gf6.SetPointMinimum((int)0);
gf6.SetPointMaximum((int)10000);
gf6.CellClippingOn();
gf6.SetCellMinimum((int)0);
gf6.SetCellMaximum((int)7500);
g6Mapper = vtkPolyDataMapper.New();
g6Mapper.SetInputConnection((vtkAlgorithmOutput)gf6.GetOutputPort());
g6Mapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0],
(double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]);
g6Actor = new vtkActor();
g6Actor.SetMapper((vtkMapper)g6Mapper);
g6Actor.AddPosition((double)0,(double)15,(double)30);
// create pipeline - rectilinear grid[]
//[]
rgridReader = new vtkRectilinearGridReader();
rgridReader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/RectGrid2.vtk");
rgridReader.Update();
gf7 = new vtkGeometryFilter();
gf7.SetInputConnection((vtkAlgorithmOutput)rgridReader.GetOutputPort());
g7Mapper = vtkPolyDataMapper.New();
g7Mapper.SetInputConnection((vtkAlgorithmOutput)gf7.GetOutputPort());
g7Mapper.SetScalarRange((double)((vtkDataSet)rgridReader.GetOutput()).GetScalarRange()[0],(double)((vtkDataSet)rgridReader.GetOutput()).GetScalarRange()[1]);
g7Actor = new vtkActor();
g7Actor.SetMapper((vtkMapper)g7Mapper);
g7Actor.SetScale((double)3,(double)3,(double)3);
gf8 = new vtkGeometryFilter();
gf8.SetInputConnection((vtkAlgorithmOutput)rgridReader.GetOutputPort());
gf8.ExtentClippingOn();
gf8.SetExtent((double)0,(double)1,(double)-2,(double)2,(double)0,(double)4);
gf8.PointClippingOn();
gf8.SetPointMinimum((int)0);
gf8.SetPointMaximum((int)10000);
gf8.CellClippingOn();
gf8.SetCellMinimum((int)0);
gf8.SetCellMaximum((int)7500);
g8Mapper = vtkPolyDataMapper.New();
g8Mapper.SetInputConnection((vtkAlgorithmOutput)gf8.GetOutputPort());
g8Mapper.SetScalarRange((double)((vtkDataSet)rgridReader.GetOutput()).GetScalarRange()[0],(double)((vtkDataSet)rgridReader.GetOutput()).GetScalarRange()[1]);
g8Actor = new vtkActor();
g8Actor.SetMapper((vtkMapper)g8Mapper);
g8Actor.SetScale((double)3,(double)3,(double)3);
g8Actor.AddPosition((double)0,(double)15,(double)0);
// Create the RenderWindow, Renderer and both Actors[]
//[]
ren1 = vtkRenderer.New();
renWin = vtkRenderWindow.New();
renWin.AddRenderer((vtkRenderer)ren1);
iren = new vtkRenderWindowInteractor();
iren.SetRenderWindow((vtkRenderWindow)renWin);
ren1.AddActor((vtkProp)gActor);
ren1.AddActor((vtkProp)g2Actor);
ren1.AddActor((vtkProp)g3Actor);
ren1.AddActor((vtkProp)g4Actor);
ren1.AddActor((vtkProp)g5Actor);
ren1.AddActor((vtkProp)g6Actor);
ren1.AddActor((vtkProp)g7Actor);
ren1.AddActor((vtkProp)g8Actor);
renWin.SetSize((int)340,(int)550);
cam1 = ren1.GetActiveCamera();
cam1.SetClippingRange((double)84,(double)174);
cam1.SetFocalPoint((double)5.22824,(double)6.09412,(double)35.9813);
cam1.SetPosition((double)100.052,(double)62.875,(double)102.818);
cam1.SetViewUp((double)-0.307455,(double)-0.464269,(double)0.830617);
iren.Initialize();
// prevent the tk window from showing up then start the event loop[]
//deleteAllVTKObjects();
}
示例10: 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();
}
示例11: 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();
}
示例12: 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();
}
示例13: 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();
}
示例14: AVfieldToRGrid
//.........这里部分代码省略.........
// create pipeline[]
//[]
plane = new vtkRectilinearGridGeometryFilter();
plane.SetInput((vtkDataObject)fd2ad.GetRectilinearGridOutput());
plane.SetExtent((int)0,(int)100,(int)0,(int)100,(int)15,(int)15);
warper = new vtkWarpVector();
warper.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
warper.SetScaleFactor((double)0.05);
planeMapper = new vtkDataSetMapper();
planeMapper.SetInputConnection((vtkAlgorithmOutput)warper.GetOutputPort());
planeMapper.SetScalarRange((double)0.197813,(double)0.710419);
planeActor = new vtkActor();
planeActor.SetMapper((vtkMapper)planeMapper);
cutPlane = new vtkPlane();
cutPlane.SetOrigin(fd2ad.GetOutput().GetCenter()[0],fd2ad.GetOutput().GetCenter()[1],fd2ad.GetOutput().GetCenter()[2]);
cutPlane.SetNormal((double)1,(double)0,(double)0);
planeCut = new vtkCutter();
planeCut.SetInput((vtkDataObject)fd2ad.GetRectilinearGridOutput());
planeCut.SetCutFunction((vtkImplicitFunction)cutPlane);
cutMapper = new vtkDataSetMapper();
cutMapper.SetInputConnection((vtkAlgorithmOutput)planeCut.GetOutputPort());
cutMapper.SetScalarRange(
(double)((vtkDataSet)fd2ad.GetOutput()).GetPointData().GetScalars().GetRange()[0],
(double)((vtkDataSet)fd2ad.GetOutput()).GetPointData().GetScalars().GetRange()[1]);
cutActor = new vtkActor();
cutActor.SetMapper((vtkMapper)cutMapper);
iso = new vtkContourFilter();
iso.SetInput((vtkDataObject)fd2ad.GetRectilinearGridOutput());
iso.SetValue((int)0,(double)0.7);
normals = new vtkPolyDataNormals();
normals.SetInputConnection((vtkAlgorithmOutput)iso.GetOutputPort());
normals.SetFeatureAngle((double)45);
isoMapper = vtkPolyDataMapper.New();
isoMapper.SetInputConnection((vtkAlgorithmOutput)normals.GetOutputPort());
isoMapper.ScalarVisibilityOff();
isoActor = new vtkActor();
isoActor.SetMapper((vtkMapper)isoMapper);
isoActor.GetProperty().SetColor((double) 1.0000, 0.8941, 0.7686 );
isoActor.GetProperty().SetRepresentationToWireframe();
streamer = new vtkStreamLine();
streamer.SetInputConnection((vtkAlgorithmOutput)fd2ad.GetOutputPort());
streamer.SetStartPosition((double)-1.2,(double)-0.1,(double)1.3);
streamer.SetMaximumPropagationTime((double)500);
streamer.SetStepLength((double)0.05);
streamer.SetIntegrationStepLength((double)0.05);
streamer.SetIntegrationDirectionToIntegrateBothDirections();
streamTube = new vtkTubeFilter();
streamTube.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
streamTube.SetRadius((double)0.025);
streamTube.SetNumberOfSides((int)6);
streamTube.SetVaryRadiusToVaryRadiusByVector();
mapStreamTube = vtkPolyDataMapper.New();
mapStreamTube.SetInputConnection((vtkAlgorithmOutput)streamTube.GetOutputPort());
mapStreamTube.SetScalarRange(
(double)((vtkDataSet)fd2ad.GetOutput()).GetPointData().GetScalars().GetRange()[0],
(double)((vtkDataSet)fd2ad.GetOutput()).GetPointData().GetScalars().GetRange()[1]);
streamTubeActor = new vtkActor();
streamTubeActor.SetMapper((vtkMapper)mapStreamTube);
streamTubeActor.GetProperty().BackfaceCullingOn();
outline = new vtkOutlineFilter();
outline.SetInput((vtkDataObject)fd2ad.GetRectilinearGridOutput());
outlineMapper = vtkPolyDataMapper.New();
outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
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.AddActor((vtkProp)planeActor);
ren1.AddActor((vtkProp)cutActor);
ren1.AddActor((vtkProp)isoActor);
ren1.AddActor((vtkProp)streamTubeActor);
ren1.SetBackground((double)1,(double)1,(double)1);
renWin.SetSize((int)300,(int)300);
ren1.GetActiveCamera().SetPosition((double)0.0390893,(double)0.184813,(double)-3.94026);
ren1.GetActiveCamera().SetFocalPoint((double)-0.00578326,(double)0,(double)0.701967);
ren1.GetActiveCamera().SetViewAngle((double)30);
ren1.GetActiveCamera().SetViewUp((double)0.00850257,(double)0.999169,(double)0.0398605);
ren1.GetActiveCamera().SetClippingRange((double)3.08127,(double)6.62716);
iren.Initialize();
// render the image[]
//[]
File.Delete("RGridField.vtk");
}
// prevent the tk window from showing up then start the event loop[]
//deleteAllVTKObjects();
}
示例15: 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();
}