Ejemplo n.º 1
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVprobeComb(String [] argv)
    {
        //Prefix Content is: ""

          // create planes[]
          // 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();
          plane = new vtkPlaneSource();
          plane.SetResolution((int)50,(int)50);
          transP1 = new vtkTransform();
          transP1.Translate((double)3.7,(double)0.0,(double)28.37);
          transP1.Scale((double)5,(double)5,(double)5);
          transP1.RotateY((double)90);
          tpd1 = new vtkTransformPolyDataFilter();
          tpd1.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
          tpd1.SetTransform((vtkAbstractTransform)transP1);
          outTpd1 = new vtkOutlineFilter();
          outTpd1.SetInputConnection((vtkAlgorithmOutput)tpd1.GetOutputPort());
          mapTpd1 = vtkPolyDataMapper.New();
          mapTpd1.SetInputConnection((vtkAlgorithmOutput)outTpd1.GetOutputPort());
          tpd1Actor = new vtkActor();
          tpd1Actor.SetMapper((vtkMapper)mapTpd1);
          tpd1Actor.GetProperty().SetColor((double)0,(double)0,(double)0);
          transP2 = new vtkTransform();
          transP2.Translate((double)9.2,(double)0.0,(double)31.20);
          transP2.Scale((double)5,(double)5,(double)5);
          transP2.RotateY((double)90);
          tpd2 = new vtkTransformPolyDataFilter();
          tpd2.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
          tpd2.SetTransform((vtkAbstractTransform)transP2);
          outTpd2 = new vtkOutlineFilter();
          outTpd2.SetInputConnection((vtkAlgorithmOutput)tpd2.GetOutputPort());
          mapTpd2 = vtkPolyDataMapper.New();
          mapTpd2.SetInputConnection((vtkAlgorithmOutput)outTpd2.GetOutputPort());
          tpd2Actor = new vtkActor();
          tpd2Actor.SetMapper((vtkMapper)mapTpd2);
          tpd2Actor.GetProperty().SetColor((double)0,(double)0,(double)0);
          transP3 = new vtkTransform();
          transP3.Translate((double)13.27,(double)0.0,(double)33.30);
          transP3.Scale((double)5,(double)5,(double)5);
          transP3.RotateY((double)90);
          tpd3 = new vtkTransformPolyDataFilter();
          tpd3.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
          tpd3.SetTransform((vtkAbstractTransform)transP3);
          outTpd3 = new vtkOutlineFilter();
          outTpd3.SetInputConnection((vtkAlgorithmOutput)tpd3.GetOutputPort());
          mapTpd3 = vtkPolyDataMapper.New();
          mapTpd3.SetInputConnection((vtkAlgorithmOutput)outTpd3.GetOutputPort());
          tpd3Actor = new vtkActor();
          tpd3Actor.SetMapper((vtkMapper)mapTpd3);
          tpd3Actor.GetProperty().SetColor((double)0,(double)0,(double)0);
          appendF = new vtkAppendPolyData();
          appendF.AddInput((vtkPolyData)tpd1.GetOutput());
          appendF.AddInput((vtkPolyData)tpd2.GetOutput());
          appendF.AddInput((vtkPolyData)tpd3.GetOutput());
          probe = new vtkProbeFilter();
          probe.SetInputConnection((vtkAlgorithmOutput)appendF.GetOutputPort());
          probe.SetSource((vtkDataObject)pl3d.GetOutput());
          contour = new vtkContourFilter();
          contour.SetInputConnection((vtkAlgorithmOutput)probe.GetOutputPort());
          contour.GenerateValues((int)50,(double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0],
          (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]);
          contourMapper = vtkPolyDataMapper.New();
          contourMapper.SetInputConnection((vtkAlgorithmOutput)contour.GetOutputPort());
          contourMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0],
          (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]);
          planeActor = new vtkActor();
          planeActor.SetMapper((vtkMapper)contourMapper);
          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)planeActor);
          ren1.AddActor((vtkProp)tpd1Actor);
          ren1.AddActor((vtkProp)tpd2Actor);
          ren1.AddActor((vtkProp)tpd3Actor);
          ren1.SetBackground((double)1,(double)1,(double)1);
          renWin.SetSize((int)400,(int)400);
          cam1 = ren1.GetActiveCamera();
          cam1.SetClippingRange((double)3.95297,(double)50);
          cam1.SetFocalPoint((double)8.88908,(double)0.595038,(double)29.3342);
          cam1.SetPosition((double)-12.3332,(double)31.7479,(double)41.2387);
          cam1.SetViewUp((double)0.060772,(double)-0.319905,(double)0.945498);
          iren.Initialize();
          // prevent the tk window from showing up then start the event loop[]

        //deleteAllVTKObjects();
    }