/// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestSplineFilter(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();
          rk4 = new vtkRungeKutta4();
          streamer = new vtkStreamLine();
          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();
          streamer.VorticityOn();
          streamer.SetIntegrator((vtkInitialValueProblemSolver)rk4);
          sf = new vtkSplineFilter();
          sf.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
          sf.SetSubdivideToLength();
          sf.SetLength((double)0.15);
          rf = new vtkRibbonFilter();
          rf.SetInputConnection((vtkAlgorithmOutput)sf.GetOutputPort());
          rf.SetWidth((double)0.1);
          rf.SetWidthFactor((double)5);
          streamMapper = vtkPolyDataMapper.New();
          streamMapper.SetInputConnection((vtkAlgorithmOutput)rf.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[]
          // for testing[]
          threshold = 15;

        //deleteAllVTKObjects();
    }
Пример #2
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void Setsf(vtkSplineFilter toSet)
 {
     sf = toSet;
 }
 ///<summary> A Set Method for Static Variables </summary>
 public static void Setsf(vtkSplineFilter toSet)
 {
     sf = toSet;
 }
Пример #4
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestSplineFilter(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 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();
        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();
        rk4      = new vtkRungeKutta4();
        streamer = new vtkStreamLine();
        streamer.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
        streamer.SetSourceConnection(ps.GetOutputPort());
        streamer.SetMaximumPropagationTime((double)100);
        streamer.SetIntegrationStepLength((double).2);
        streamer.SetStepLength((double).001);
        streamer.SetNumberOfThreads((int)1);
        streamer.SetIntegrationDirectionToForward();
        streamer.VorticityOn();
        streamer.SetIntegrator((vtkInitialValueProblemSolver)rk4);
        sf = new vtkSplineFilter();
        sf.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
        sf.SetSubdivideToLength();
        sf.SetLength((double)0.15);
        rf = new vtkRibbonFilter();
        rf.SetInputConnection((vtkAlgorithmOutput)sf.GetOutputPort());
        rf.SetWidth((double)0.1);
        rf.SetWidthFactor((double)5);
        streamMapper = vtkPolyDataMapper.New();
        streamMapper.SetInputConnection((vtkAlgorithmOutput)rf.GetOutputPort());
        streamMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
                                    (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
        streamline = new vtkActor();
        streamline.SetMapper((vtkMapper)streamMapper);
        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);
        // 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[]
        // for testing[]
        threshold = 15;

//deleteAllVTKObjects();
    }