]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx
\ No newline at end of file
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxMaracas_N_ViewersWidget.cxx
index d791fd378dcf97b3149349b6cf986e22744b5458..16e0ddf76d6ad29ae8e5cd26d87f633e38f0f63c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracas_N_ViewersWidget.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/05/14 13:54:35 $
-  Version:   $Revision: 1.9 $
+  Date:      $Date: 2010/02/04 10:54:49 $
+  Version:   $Revision: 1.14 $
 
   Copyright: (c) 2002, 2003
   License:
        wxMaracas_N_ViewersWidget::wxMaracas_N_ViewersWidget(wxWindow *parent, vtkImageData* imagedata, std::vector<int> *nTypeView)
                : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
        {
-               wxwindow1       = NULL;
-               wxwindow2       = NULL;
-               wxwindow3       = NULL;
-               wxwindow4       = NULL;
-
-               _currentwxw = NULL;
-
+               wxwindow1               = NULL;
+               wxwindow2               = NULL;
+               wxwindow3               = NULL;
+               wxwindow4               = NULL;
+               _currentwxw             = NULL;
+               mvtkmprbasedata = NULL;
+               
                wxSizer *sizer  = new wxBoxSizer(wxVERTICAL);
                this->SetSizer(sizer);
                this->SetAutoLayout(true);
          
        wxMaracas_N_ViewersWidget::~wxMaracas_N_ViewersWidget()
        {
-               
+               if (mvtkmprbasedata!=NULL)
+               {
+                       delete mvtkmprbasedata;
+               }
+
        }
        //------------------------------------------------------------------------------------------------------------
        // Methods
        }
 
        void wxMaracas_N_ViewersWidget::RefreshView()
-       {
+       {               
                if (wxwindow1!=NULL) {wxwindow1->RefreshView(); }
                if (wxwindow2!=NULL) {wxwindow2->RefreshView(); }
                if (wxwindow3!=NULL) {wxwindow3->RefreshView(); }
        }
    
        //-------------------------------------------------------------------------
- void wxMaracas_N_ViewersWidget::Refresh(bool eraseBackground, const wxRect* rect )
- {
-        wxPanel::Refresh(false);
- }
      void wxMaracas_N_ViewersWidget::Refresh(bool eraseBackground, const wxRect* rect )
      {
+               wxPanel::Refresh(false);
      }
 
- void wxMaracas_N_ViewersWidget::UpdateLayout(vtkImageData* imagedata){
+       //-------------------------------------------------------------------------
+       void wxMaracas_N_ViewersWidget::UpdateLayout(vtkImageData* imagedata)
+       {
 
                wxWindow                                *wxwindow       = NULL;
-               wxSizer *sizer  = this->GetSizer();     
+               wxSizer *sizer                                          = this->GetSizer();     
+               
+               if (mvtkmprbasedata!=NULL)
+               {
+                       delete mvtkmprbasedata;
+               }
+               
+               marImageData    *marimagedata   = new marImageData( imagedata );                        
+               mvtkmprbasedata                                 = new vtkMPRBaseData(); 
+               mvtkmprbasedata->SetMarImageData(marimagedata);
                
                if(_currentwxw != NULL){
                        _currentwxw->Show(false);
                //std::cout<<"size "<<nTypeView->size()<<std::endl;
                if (nTypeView->size()==1)
                {
-                       wxwindow1 = new wxMaracas_ViewerWidget(this, imagedata, (*nTypeView)[0]);
+                       wxwindow1 = new wxMaracas_ViewerWidget(this, imagedata, (*nTypeView)[0],mvtkmprbasedata);
 
                        wxwindow1->ConfigureVTK();
                        wxwindow = wxwindow1;
                }else   if (nTypeView->size()==2)       {
-
-                       
                        wxSplitterWindow        *spliter        = new wxSplitterWindow( this , -1);
-                       wxwindow1 = new wxMaracas_ViewerWidget(spliter, imagedata, (*nTypeView)[0]);
-                       wxwindow2 = new wxMaracas_ViewerWidget(spliter, imagedata, (*nTypeView)[1]);
+                       spliter->SetMinimumPaneSize(1);
+                       wxwindow1 = new wxMaracas_ViewerWidget(spliter, imagedata, (*nTypeView)[0],mvtkmprbasedata);
+                       wxwindow2 = new wxMaracas_ViewerWidget(spliter, imagedata, (*nTypeView)[1],mvtkmprbasedata);
                        wxwindow1->ConfigureVTK();
                        wxwindow2->ConfigureVTK();
                        spliter -> SplitVertically( wxwindow1 , wxwindow2  );
-                       wxwindow = spliter;
+                       wxwindow = spliter;                     
                }else if (nTypeView->size()==3)
                {
                        wxSplitterWindow        *spliter        = new wxSplitterWindow( this , -1);
                        wxSplitterWindow        *spliterA       = new wxSplitterWindow( spliter , -1);
-                       wxwindow1 = new wxMaracas_ViewerWidget(spliter , imagedata, (*nTypeView)[0]);
-                       wxwindow2 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[1]);
-                       wxwindow3 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[2]);
+                       spliter->SetMinimumPaneSize(1);
+                       spliterA->SetMinimumPaneSize(1);
+                       wxwindow1 = new wxMaracas_ViewerWidget(spliter , imagedata, (*nTypeView)[0],mvtkmprbasedata);
+                       wxwindow2 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[1],mvtkmprbasedata);
+                       wxwindow3 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[2],mvtkmprbasedata);
                        wxwindow1->ConfigureVTK();
                        wxwindow2->ConfigureVTK();
                        wxwindow3->ConfigureVTK();
                        wxSplitterWindow        *spliter        = new wxSplitterWindow( this , -1);
                        wxSplitterWindow        *spliterA       = new wxSplitterWindow( spliter , -1);
                        wxSplitterWindow        *spliterB       = new wxSplitterWindow( spliter , -1);
-                       wxwindow1 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[0]);
-                       wxwindow2 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[1]);
-                       wxwindow3 = new wxMaracas_ViewerWidget(spliterB, imagedata, (*nTypeView)[2]);
-                       wxwindow4 = new wxMaracas_ViewerWidget(spliterB, imagedata, (*nTypeView)[3]);
+                       spliter->SetMinimumPaneSize(1);
+                       spliterA->SetMinimumPaneSize(1);
+                       spliterB->SetMinimumPaneSize(1);
+                       wxwindow1 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[0],mvtkmprbasedata);
+                       wxwindow2 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[1],mvtkmprbasedata);
+                       wxwindow3 = new wxMaracas_ViewerWidget(spliterB, imagedata, (*nTypeView)[2],mvtkmprbasedata);
+                       wxwindow4 = new wxMaracas_ViewerWidget(spliterB, imagedata, (*nTypeView)[3],mvtkmprbasedata);
                        wxwindow1->ConfigureVTK();
                        wxwindow2->ConfigureVTK();
                        wxwindow3->ConfigureVTK();
                this->Refresh();
  }
 
+
+//-----------------------------------------------------------------------------------
  void wxMaracas_N_ViewersWidget::SetType(std::vector<int>* type){
         nTypeView = type;
  }
+
+
+
+//-----------------------------------------------------------------------------------
  void wxMaracas_N_ViewersWidget::SetImage( vtkImageData *image )
  {
-        if (wxwindow1!=NULL) { 
-                
-               wxwindow1->SetImage(image); 
-       }
+        if (wxwindow1!=NULL) { wxwindow1->SetImage(image); }
         if (wxwindow2!=NULL) { wxwindow2->SetImage(image); } 
         if (wxwindow3!=NULL) { wxwindow3->SetImage(image); }
         if (wxwindow4!=NULL) { wxwindow4->SetImage(image); }
-
-
  }
 
+//-----------------------------------------------------------------------------------
+ void wxMaracas_N_ViewersWidget::ConfigureVTK()
+ {
+        if (wxwindow1!=NULL) { wxwindow1->ConfigureVTK(); }
+        if (wxwindow2!=NULL) { wxwindow2->ConfigureVTK(); }
+        if (wxwindow3!=NULL) { wxwindow3->ConfigureVTK(); }
+        if (wxwindow4!=NULL) { wxwindow4->ConfigureVTK(); }
+ }
 
+//-----------------------------------------------------------------------------------
 double wxMaracas_N_ViewersWidget :: GetX()
 {
-       return wxwindow1->GetX();
+       return mvtkmprbasedata->GetX();
+//     return wxwindow1->GetX();
 }
 
+//-----------------------------------------------------------------------------------
 double wxMaracas_N_ViewersWidget :: GetY()
 {
-       return wxwindow1->GetY();
+       return mvtkmprbasedata->GetY();
+//     return wxwindow1->GetY();
 }
 
 
+//-----------------------------------------------------------------------------------
 double wxMaracas_N_ViewersWidget :: GetZ()
 {
-       return wxwindow1->GetZ();
+       return mvtkmprbasedata->GetZ();
+//     return wxwindow1->GetZ();
 }
 
+void wxMaracas_N_ViewersWidget::setColorTransferFunction(vtkColorTransferFunction* colortable){
+    if (wxwindow1!=NULL) {
+               wxwindow1->setColorTransferFunction(colortable);
+       }
+       if (wxwindow2!=NULL) {
+               wxwindow2->setColorTransferFunction(colortable);
+       }
+       if (wxwindow3!=NULL) {
+               wxwindow3->setColorTransferFunction(colortable);
+       }
+       if (wxwindow4!=NULL) {
+               wxwindow4->setColorTransferFunction(colortable);
+       }
+}
 
-/*
-double wxMaracas_N_ViewersWidget :: GetZ(int iWin)
-       {
-               double answerVal = 0.0;
-               if  (iWin==1)
-               {
-                       answerVal = wxwindow1->GetZ();
-               }
-               if  (iWin==2)
-               {
-                       answerVal = wxwindow2->GetZ();
-               }
-               if  (iWin==3)
-               {
-                       answerVal = wxwindow3->GetZ();
-               }
-               if  (iWin==4)
-               {
-                       answerVal = wxwindow4->GetZ();
-               }
-               return answerVal;
+void wxMaracas_N_ViewersWidget::setWindowLevel(double level){
+       if (wxwindow1!=NULL) {
+               wxwindow1->setWindowLevel(level);
+       }
+       if (wxwindow2!=NULL) {
+               wxwindow2->setWindowLevel(level);
+       }
+       if (wxwindow3!=NULL) {
+               wxwindow3->setWindowLevel(level);
+       }
+       if (wxwindow4!=NULL) {
+               wxwindow4->setWindowLevel(level);
        }
-*/
+}
+void wxMaracas_N_ViewersWidget::setColorLevel(double level){
+       if (wxwindow1!=NULL) {
+               wxwindow1->setColorLevel(level);
+       }
+       if (wxwindow2!=NULL) {
+               wxwindow2->setColorLevel(level);
+       }
+       if (wxwindow3!=NULL) {
+               wxwindow3->setColorLevel(level);
+       }
+       if (wxwindow4!=NULL) {
+               wxwindow4->setColorLevel(level);
+       }
+}
+