Example #1
0
        /// <summary>
        /// Set up the dialog
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void renderWindowControl1_Load(object sender, EventArgs e)
        {
            //Setup the variables and the background
            vtkRenderer ren1 = renderWindowControl1.RenderWindow.GetRenderers().GetFirstRenderer();

            mapper.SetInputConnection(puzzle.GetOutputPort());
            mapper2.SetInputConnection(arrows.GetOutputPort());
            actor.SetMapper(mapper);
            actor2.SetMapper(mapper2);
            ren1.AddActor(actor);
            ren1.AddActor(actor2);
            ren1.SetBackground(0.1, 0.2, 0.4);

            //Set up the camera
            ren1.ResetCamera();
            vtkCamera cam = ren1.GetActiveCamera();

            cam.Elevation(-40);
            renderWindowControl1.RenderWindow.Render();

            //Change the style to a trackball style
            //Equivalent of pressing 't'
            vtkRenderWindowInteractor iren   = renderWindowControl1.RenderWindow.GetInteractor();
            vtkInteractorStyleSwitch  istyle = vtkInteractorStyleSwitch.New();

            iren.SetInteractorStyle(istyle);
            (istyle).SetCurrentStyleToTrackballCamera();

            //Add events to the iren instead of Observers
            iren.MouseMoveEvt += new vtkObject.vtkObjectEventHandler(MotionCallback);
            iren.CharEvt      += new vtkObject.vtkObjectEventHandler(CharCallback);
        }
    /// <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();
    }
Example #3
0
    /// <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();
    }