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

          //[]
          // Demonstrate the use of implicit selection loop as well as closest point[]
          // connectivity[]
          //[]
          // create pipeline[]
          //[]
          sphere = new vtkSphereSource();
          sphere.SetRadius((double)1);
          sphere.SetPhiResolution((int)100);
          sphere.SetThetaResolution((int)100);
          selectionPoints = new vtkPoints();
          selectionPoints.InsertPoint((int)0,(double)0.07325,(double)0.8417,(double)0.5612);
          selectionPoints.InsertPoint((int)1,(double)0.07244,(double)0.6568,(double)0.7450);
          selectionPoints.InsertPoint((int)2,(double)0.1727,(double)0.4597,(double)0.8850);
          selectionPoints.InsertPoint((int)3,(double)0.3265,(double)0.6054,(double)0.7309);
          selectionPoints.InsertPoint((int)4,(double)0.5722,(double)0.5848,(double)0.5927);
          selectionPoints.InsertPoint((int)5,(double)0.4305,(double)0.8138,(double)0.4189);
          loop = new vtkImplicitSelectionLoop();
          loop.SetLoop((vtkPoints)selectionPoints);
          extract = new vtkExtractGeometry();
          extract.SetInputConnection((vtkAlgorithmOutput)sphere.GetOutputPort());
          extract.SetImplicitFunction((vtkImplicitFunction)loop);
          connect = new vtkConnectivityFilter();
          connect.SetInputConnection((vtkAlgorithmOutput)extract.GetOutputPort());
          connect.SetExtractionModeToClosestPointRegion();
          connect.SetClosestPoint((double)selectionPoints.GetPoint((int)0)[0], (double)selectionPoints.GetPoint((int)0)[1],(double)selectionPoints.GetPoint((int)0)[2]);
          clipMapper = new vtkDataSetMapper();
          clipMapper.SetInputConnection((vtkAlgorithmOutput)connect.GetOutputPort());
          backProp = new vtkProperty();
          backProp.SetDiffuseColor((double) 1.0000, 0.3882, 0.2784 );
          clipActor = new vtkActor();
          clipActor.SetMapper((vtkMapper)clipMapper);
          clipActor.GetProperty().SetColor((double) 0.2000, 0.6300, 0.7900 );
          clipActor.SetBackfaceProperty((vtkProperty)backProp);
          // Create graphics stuff[]
          //[]
          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)clipActor);
          ren1.SetBackground((double)1,(double)1,(double)1);
          ren1.ResetCamera();
          ren1.GetActiveCamera().Azimuth((double)30);
          ren1.GetActiveCamera().Elevation((double)30);
          ren1.GetActiveCamera().Dolly((double)1.2);
          ren1.ResetCameraClippingRange();
          renWin.SetSize((int)400,(int)400);
          renWin.Render();
          // render the image[]
          //[]
          // prevent the tk window from showing up then start the event loop[]

        //deleteAllVTKObjects();
    }
Esempio n. 2
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void Setloop(vtkImplicitSelectionLoop toSet)
 {
     loop = toSet;
 }
Esempio n. 3
0
 ///<summary> A Set Method for Static Variables </summary>
 public static void Setloop(vtkImplicitSelectionLoop toSet)
 {
     loop = toSet;
 }
Esempio n. 4
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVSelectionLoop(String [] argv)
    {
        //Prefix Content is: ""

        //[]
        // Demonstrate the use of implicit selection loop as well as closest point[]
        // connectivity[]
        //[]
        // create pipeline[]
        //[]
        sphere = new vtkSphereSource();
        sphere.SetRadius((double)1);
        sphere.SetPhiResolution((int)100);
        sphere.SetThetaResolution((int)100);
        selectionPoints = new vtkPoints();
        selectionPoints.InsertPoint((int)0, (double)0.07325, (double)0.8417, (double)0.5612);
        selectionPoints.InsertPoint((int)1, (double)0.07244, (double)0.6568, (double)0.7450);
        selectionPoints.InsertPoint((int)2, (double)0.1727, (double)0.4597, (double)0.8850);
        selectionPoints.InsertPoint((int)3, (double)0.3265, (double)0.6054, (double)0.7309);
        selectionPoints.InsertPoint((int)4, (double)0.5722, (double)0.5848, (double)0.5927);
        selectionPoints.InsertPoint((int)5, (double)0.4305, (double)0.8138, (double)0.4189);
        loop = new vtkImplicitSelectionLoop();
        loop.SetLoop((vtkPoints)selectionPoints);
        extract = new vtkExtractGeometry();
        extract.SetInputConnection((vtkAlgorithmOutput)sphere.GetOutputPort());
        extract.SetImplicitFunction((vtkImplicitFunction)loop);
        connect = new vtkConnectivityFilter();
        connect.SetInputConnection((vtkAlgorithmOutput)extract.GetOutputPort());
        connect.SetExtractionModeToClosestPointRegion();
        connect.SetClosestPoint((double)selectionPoints.GetPoint((int)0)[0], (double)selectionPoints.GetPoint((int)0)[1], (double)selectionPoints.GetPoint((int)0)[2]);
        clipMapper = new vtkDataSetMapper();
        clipMapper.SetInputConnection((vtkAlgorithmOutput)connect.GetOutputPort());
        backProp = new vtkProperty();
        backProp.SetDiffuseColor((double)1.0000, 0.3882, 0.2784);
        clipActor = new vtkActor();
        clipActor.SetMapper((vtkMapper)clipMapper);
        clipActor.GetProperty().SetColor((double)0.2000, 0.6300, 0.7900);
        clipActor.SetBackfaceProperty((vtkProperty)backProp);
        // Create graphics stuff[]
        //[]
        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)clipActor);
        ren1.SetBackground((double)1, (double)1, (double)1);
        ren1.ResetCamera();
        ren1.GetActiveCamera().Azimuth((double)30);
        ren1.GetActiveCamera().Elevation((double)30);
        ren1.GetActiveCamera().Dolly((double)1.2);
        ren1.ResetCameraClippingRange();
        renWin.SetSize((int)400, (int)400);
        renWin.Render();
        // render the image[]
        //[]
        // prevent the tk window from showing up then start the event loop[]

//deleteAllVTKObjects();
    }