wxVtk3DBaseView.cxx

Go to the documentation of this file.
00001 #include "wxVtk3DBaseView.h"
00002 
00003 #include "vtkInteractorStyleBaseView3D.h"
00004 
00005 
00006 wxVtk3DBaseView::wxVtk3DBaseView(wxWindow *parent)
00007 :wxVtkBaseView( parent )
00008 {
00009         _configure      = false;
00010         _aRenderer      = NULL;
00011         _renWin         = NULL;
00012         _aCamera        = NULL;
00013 }
00014 //-------------------------------------------------------------------
00015 wxVtk3DBaseView::~wxVtk3DBaseView()
00016 {
00017         if (_aCamera!=NULL)     { _aCamera              -> Delete(); }
00018         if (_aRenderer!=NULL)   { _aRenderer    -> Delete(); }
00019         if (_renWin!=NULL)      { _renWin               -> Delete(); }
00020 }
00021 //-------------------------------------------------------------------
00022 vtkCamera* wxVtk3DBaseView::GetCamera()
00023 {
00024         return _aCamera;
00025 }
00026 //-------------------------------------------------------------------
00027 vtkRenderer* wxVtk3DBaseView::GetRenderer()  // virtual
00028 {
00029         return _aRenderer;
00030 }
00031 //-------------------------------------------------------------------
00032 vtkRenderWindow* wxVtk3DBaseView::GetRenWin()  // virtual
00033 {
00034         return _renWin;
00035 }
00036 //-------------------------------------------------------------------
00037 void wxVtk3DBaseView::Refresh()
00038 {
00039 //      _renWin->Render();
00040         vtkRenderWindowInteractor *vri = GetWxVTKRenderWindowInteractor();
00041         vri->vtkRenderWindowInteractor::Render();
00042 }
00043 //-------------------------------------------------------------------
00044 void wxVtk3DBaseView::Configure()
00045 {
00046         if (_configure==false)
00047         {
00048                 _configure=true;
00049                 //wxVtkBaseView::Configure();
00050                 _aRenderer      = vtkRenderer::New();
00051                 _renWin         = vtkRenderWindow::New();
00052                 _renWin->AddRenderer(_aRenderer);
00053 
00054                 _aRenderer->GradientBackgroundOn();
00055                 _aRenderer->SetBackground( 0.33 , 0.33 , 0.33 );
00056                 _aRenderer->SetBackground2( 0.66 , 0.66 , 0.66 );
00057                 
00058                 
00059 //       _renWin->SetStereoCapableWindow(1);
00060 // //      //renderwindow->SetStereoTypeToCrystalEyes();  
00061 //       _renWin->SetStereoTypeToRedBlue();
00062 //       _renWin->SetStereoRender(1);
00063 
00064                 GetWxVTKRenderWindowInteractor()->SetRenderWindow(_renWin);
00065 
00066 
00067 // EED Borrame
00068 //              vtkInteractorStyle3DMaracas *interactorStyle3DMaracas = vtkInteractorStyle3DMaracas::New(); 
00069                 vtkInteractorStyleBaseView3D *interactorStyleBaseView3D = vtkInteractorStyleBaseView3D::New(); 
00070 
00071                 SetInteractorStyleBaseView( interactorStyleBaseView3D );
00072                 interactorStyleBaseView3D->SetInteractor (  GetWxVTKRenderWindowInteractor() );
00073                 GetWxVTKRenderWindowInteractor()->SetInteractorStyle( interactorStyleBaseView3D );
00074                 interactorStyleBaseView3D->SetwxVtkBaseView(this);      
00075 
00076 
00077 /* EED Borrame
00078   vtkInteractorStyleSwitch *iss = dynamic_cast<vtkInteractorStyleSwitch*>(_iren->GetInteractorStyle());
00079   iss->SetCurrentStyleToTrackballCamera();
00080 */
00081 
00082                 // It is convenient to create an initial view of the data. The
00083                 // FocalPoint and Position form a vector direction. Later on
00084                 // (ResetCamera() method) this vector is used to position the camera
00085                 // to look at the data in this direction.
00086                 _aCamera = vtkCamera::New();
00087 
00088 //EED 17Avril2009       
00089 /*
00090                 _aCamera->SetViewUp (0, 0, -1);
00091                 _aCamera->SetPosition (0, 1, 0);
00092  */
00093                 _aCamera->SetViewUp (0, 1, 0);
00094                 _aCamera->SetPosition (0, 0, 1);
00095                 
00096                 _aCamera->SetFocalPoint (0, 0, 0);
00097                 _aCamera->ComputeViewPlaneNormal();
00098 
00099         }
00100 }
00101 //-------------------------------------------------------------------
00102 //EED 27 sep 2006
00103 void wxVtk3DBaseView::GetSpacing(double spc[3])
00104 {
00105         spc[0]=1;
00106         spc[1]=1;
00107         spc[2]=1;
00108 }
00109 

Generated on Wed Jul 29 16:35:31 2009 for creaMaracasVisu_lib by  doxygen 1.5.3