/// <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
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void Setpiece(vtkExtractPolyDataPiece toSet)
 {
     piece = toSet;
 }
 ///<summary> A Set Method for Static Variables </summary>
 public static void Setextract4(vtkExtractPolyDataPiece toSet)
 {
     extract4 = toSet;
 }
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestPolyDataPieces(String [] argv)
    {
        //Prefix Content is: ""

        math = new vtkMath();
        vtkMath.RandomSeed((int)22);
        pf = new vtkParallelFactory();
        vtkParallelFactory.RegisterFactory((vtkObjectFactory)pf);
        sphere = new vtkSphereSource();
        sphere.SetPhiResolution((int)32);
        sphere.SetThetaResolution((int)32);
        extract = new vtkExtractPolyDataPiece();
        extract.SetInputConnection((vtkAlgorithmOutput)sphere.GetOutputPort());
        normals = new vtkPolyDataNormals();
        normals.SetInputConnection((vtkAlgorithmOutput)extract.GetOutputPort());
        ps = new vtkPieceScalars();
        ps.SetInputConnection((vtkAlgorithmOutput)normals.GetOutputPort());
        mapper = vtkPolyDataMapper.New();
        mapper.SetInputConnection((vtkAlgorithmOutput)ps.GetOutputPort());
        mapper.SetNumberOfPieces((int)2);
        actor = new vtkActor();
        actor.SetMapper((vtkMapper)mapper);
        sphere2 = new vtkSphereSource();
        sphere2.SetPhiResolution((int)32);
        sphere2.SetThetaResolution((int)32);
        extract2 = new vtkExtractPolyDataPiece();
        extract2.SetInputConnection((vtkAlgorithmOutput)sphere2.GetOutputPort());
        mapper2 = vtkPolyDataMapper.New();
        mapper2.SetInputConnection((vtkAlgorithmOutput)extract2.GetOutputPort());
        mapper2.SetNumberOfPieces((int)2);
        mapper2.SetPiece((int)1);
        mapper2.SetScalarRange((double)0, (double)4);
        mapper2.SetScalarModeToUseCellFieldData();
        mapper2.SetColorModeToMapScalars();
        mapper2.ColorByArrayComponent((string)"vtkGhostLevels", (int)0);
        mapper2.SetGhostLevel((int)4);
        // check the pipeline size[]
        extract2.UpdateInformation();
        psize = new vtkPipelineSize();
        if ((psize.GetEstimatedSize((vtkAlgorithm)extract2, (int)0, (int)0)) > 100)
        {
            //puts skipedputs ['stderr', '"ERROR: Pipeline Size increased"']
        }


        if ((psize.GetNumberOfSubPieces((uint)10, (vtkPolyDataMapper)mapper2)) != 2)
        {
            //puts skipedputs ['stderr', '"ERROR: Number of sub pieces changed"']
        }


        actor2 = new vtkActor();
        actor2.SetMapper((vtkMapper)mapper2);
        actor2.SetPosition((double)1.5, (double)0, (double)0);
        sphere3 = new vtkSphereSource();
        sphere3.SetPhiResolution((int)32);
        sphere3.SetThetaResolution((int)32);
        extract3 = new vtkExtractPolyDataPiece();
        extract3.SetInputConnection((vtkAlgorithmOutput)sphere3.GetOutputPort());
        ps3 = new vtkPieceScalars();
        ps3.SetInputConnection((vtkAlgorithmOutput)extract3.GetOutputPort());
        mapper3 = vtkPolyDataMapper.New();
        mapper3.SetInputConnection((vtkAlgorithmOutput)ps3.GetOutputPort());
        mapper3.SetNumberOfSubPieces((int)8);
        mapper3.SetScalarRange((double)0, (double)8);
        actor3 = new vtkActor();
        actor3.SetMapper((vtkMapper)mapper3);
        actor3.SetPosition((double)0, (double)-1.5, (double)0);
        sphere4 = new vtkSphereSource();
        sphere4.SetPhiResolution((int)32);
        sphere4.SetThetaResolution((int)32);
        extract4 = new vtkExtractPolyDataPiece();
        extract4.SetInputConnection((vtkAlgorithmOutput)sphere4.GetOutputPort());
        ps4 = new vtkPieceScalars();
        ps4.RandomModeOn();
        ps4.SetScalarModeToCellData();
        ps4.SetInputConnection((vtkAlgorithmOutput)extract4.GetOutputPort());
        mapper4 = vtkPolyDataMapper.New();
        mapper4.SetInputConnection((vtkAlgorithmOutput)ps4.GetOutputPort());
        mapper4.SetNumberOfSubPieces((int)8);
        mapper4.SetScalarRange((double)0, (double)8);
        actor4 = new vtkActor();
        actor4.SetMapper((vtkMapper)mapper4);
        actor4.SetPosition((double)1.5, (double)-1.5, (double)0);
        ren = vtkRenderer.New();
        ren.AddActor((vtkProp)actor);
        ren.AddActor((vtkProp)actor2);
        ren.AddActor((vtkProp)actor3);
        ren.AddActor((vtkProp)actor4);
        renWin = vtkRenderWindow.New();
        renWin.AddRenderer((vtkRenderer)ren);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        iren.Initialize();

//deleteAllVTKObjects();
    }
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestPolyDataPieces(String [] argv)
    {
        //Prefix Content is: ""

          math = new vtkMath();
          vtkMath.RandomSeed((int)22);
          pf = new vtkParallelFactory();
          vtkParallelFactory.RegisterFactory((vtkObjectFactory)pf);
          sphere = new vtkSphereSource();
          sphere.SetPhiResolution((int)32);
          sphere.SetThetaResolution((int)32);
          extract = new vtkExtractPolyDataPiece();
          extract.SetInputConnection((vtkAlgorithmOutput)sphere.GetOutputPort());
          normals = new vtkPolyDataNormals();
          normals.SetInputConnection((vtkAlgorithmOutput)extract.GetOutputPort());
          ps = new vtkPieceScalars();
          ps.SetInputConnection((vtkAlgorithmOutput)normals.GetOutputPort());
          mapper = vtkPolyDataMapper.New();
          mapper.SetInputConnection((vtkAlgorithmOutput)ps.GetOutputPort());
          mapper.SetNumberOfPieces((int)2);
          actor = new vtkActor();
          actor.SetMapper((vtkMapper)mapper);
          sphere2 = new vtkSphereSource();
          sphere2.SetPhiResolution((int)32);
          sphere2.SetThetaResolution((int)32);
          extract2 = new vtkExtractPolyDataPiece();
          extract2.SetInputConnection((vtkAlgorithmOutput)sphere2.GetOutputPort());
          mapper2 = vtkPolyDataMapper.New();
          mapper2.SetInputConnection((vtkAlgorithmOutput)extract2.GetOutputPort());
          mapper2.SetNumberOfPieces((int)2);
          mapper2.SetPiece((int)1);
          mapper2.SetScalarRange((double)0,(double)4);
          mapper2.SetScalarModeToUseCellFieldData();
          mapper2.SetColorModeToMapScalars();
          mapper2.ColorByArrayComponent((string)"vtkGhostLevels",(int)0);
          mapper2.SetGhostLevel((int)4);
          // check the pipeline size[]
          extract2.UpdateInformation();
          psize = new vtkPipelineSize();
          if ((psize.GetEstimatedSize((vtkAlgorithm)extract2,(int)0,(int)0)) > 100)
        {
          //puts skipedputs ['stderr', '"ERROR: Pipeline Size increased"']
        }

          if ((psize.GetNumberOfSubPieces((uint)10,(vtkPolyDataMapper)mapper2)) != 2)
        {
          //puts skipedputs ['stderr', '"ERROR: Number of sub pieces changed"']
        }

          actor2 = new vtkActor();
          actor2.SetMapper((vtkMapper)mapper2);
          actor2.SetPosition((double)1.5,(double)0,(double)0);
          sphere3 = new vtkSphereSource();
          sphere3.SetPhiResolution((int)32);
          sphere3.SetThetaResolution((int)32);
          extract3 = new vtkExtractPolyDataPiece();
          extract3.SetInputConnection((vtkAlgorithmOutput)sphere3.GetOutputPort());
          ps3 = new vtkPieceScalars();
          ps3.SetInputConnection((vtkAlgorithmOutput)extract3.GetOutputPort());
          mapper3 = vtkPolyDataMapper.New();
          mapper3.SetInputConnection((vtkAlgorithmOutput)ps3.GetOutputPort());
          mapper3.SetNumberOfSubPieces((int)8);
          mapper3.SetScalarRange((double)0,(double)8);
          actor3 = new vtkActor();
          actor3.SetMapper((vtkMapper)mapper3);
          actor3.SetPosition((double)0,(double)-1.5,(double)0);
          sphere4 = new vtkSphereSource();
          sphere4.SetPhiResolution((int)32);
          sphere4.SetThetaResolution((int)32);
          extract4 = new vtkExtractPolyDataPiece();
          extract4.SetInputConnection((vtkAlgorithmOutput)sphere4.GetOutputPort());
          ps4 = new vtkPieceScalars();
          ps4.RandomModeOn();
          ps4.SetScalarModeToCellData();
          ps4.SetInputConnection((vtkAlgorithmOutput)extract4.GetOutputPort());
          mapper4 = vtkPolyDataMapper.New();
          mapper4.SetInputConnection((vtkAlgorithmOutput)ps4.GetOutputPort());
          mapper4.SetNumberOfSubPieces((int)8);
          mapper4.SetScalarRange((double)0,(double)8);
          actor4 = new vtkActor();
          actor4.SetMapper((vtkMapper)mapper4);
          actor4.SetPosition((double)1.5,(double)-1.5,(double)0);
          ren = vtkRenderer.New();
          ren.AddActor((vtkProp)actor);
          ren.AddActor((vtkProp)actor2);
          ren.AddActor((vtkProp)actor3);
          ren.AddActor((vtkProp)actor4);
          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)ren);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          iren.Initialize();

        //deleteAllVTKObjects();
    }
 ///<summary> A Set Method for Static Variables </summary>
 public static void Setextract4(vtkExtractPolyDataPiece toSet)
 {
     extract4 = toSet;
 }
 ///<summary> A Set Method for Static Variables </summary>
 public static void Setpiece(vtkExtractPolyDataPiece toSet)
 {
     piece = toSet;
 }