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 
00055 //       _renWin->SetStereoCapableWindow(1);
00056 // //      //renderwindow->SetStereoTypeToCrystalEyes();  
00057 //       _renWin->SetStereoTypeToRedBlue();
00058 //       _renWin->SetStereoRender(1);
00059 
00060                 GetWxVTKRenderWindowInteractor()->SetRenderWindow(_renWin);
00061 
00062 
00063 // EED Borrame
00064 //              vtkInteractorStyle3DMaracas *interactorStyle3DMaracas = vtkInteractorStyle3DMaracas::New(); 
00065                 vtkInteractorStyleBaseView3D *interactorStyleBaseView3D = vtkInteractorStyleBaseView3D::New(); 
00066 
00067                 SetInteractorStyleBaseView( interactorStyleBaseView3D );
00068                 interactorStyleBaseView3D->SetInteractor (  GetWxVTKRenderWindowInteractor() );
00069                 GetWxVTKRenderWindowInteractor()->SetInteractorStyle( interactorStyleBaseView3D );
00070                 interactorStyleBaseView3D->SetwxVtkBaseView(this);      
00071 
00072 
00073 /* EED Borrame
00074   vtkInteractorStyleSwitch *iss = dynamic_cast<vtkInteractorStyleSwitch*>(_iren->GetInteractorStyle());
00075   iss->SetCurrentStyleToTrackballCamera();
00076 */
00077 
00078                 // It is convenient to create an initial view of the data. The
00079                 // FocalPoint and Position form a vector direction. Later on
00080                 // (ResetCamera() method) this vector is used to position the camera
00081                 // to look at the data in this direction.
00082                 _aCamera = vtkCamera::New();
00083 
00084 //EED 17Avril2009       
00085 /*
00086                 _aCamera->SetViewUp (0, 0, -1);
00087                 _aCamera->SetPosition (0, 1, 0);
00088  */
00089                 _aCamera->SetViewUp (0, 1, 0);
00090                 _aCamera->SetPosition (0, 0, 1);
00091                 
00092                 _aCamera->SetFocalPoint (0, 0, 0);
00093                 _aCamera->ComputeViewPlaneNormal();
00094 
00095         }
00096 }
00097 //-------------------------------------------------------------------
00098 //EED 27 sep 2006
00099 void wxVtk3DBaseView::GetSpacing(double spc[3])
00100 {
00101         spc[0]=1;
00102         spc[1]=1;
00103         spc[2]=1;
00104 }

Generated on Fri Jun 12 00:08:34 2009 for creaMaracasVisu by  doxygen 1.5.7.1