]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSuperpositionPanel.cxx
99bb342acf75e1aeb960543b6088c83a9cb1429d
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxMaracasSuperpositionPanel.cxx
1
2 //----------------------------------------------------------------------------------------------------------------
3 // Class definition include
4 //----------------------------------------------------------------------------------------------------------------
5 #include "wxMaracasSuperpositionPanel.h"
6
7 //----------------------------------------------------------------------------------------------------------------
8 // Other includes
9 //----------------------------------------------------------------------------------------------------------------
10         
11         //------------------------------------------------------------------------------------------------------------
12         // Constructors & Destructors
13         //------------------------------------------------------------------------------------------------------------
14
15         wxMaracasSuperpositionPanel :: wxMaracasSuperpositionPanel ( std::vector<vtkImageData*> imgs, int type, wxWindow *parent, const wxPoint& pos, const wxSize& size,long style, int vertStart, int vertEnd, int horzStart, int horzEnd )   
16         :wxPanel(parent, -1, pos, size, style)          
17         {                               
18                 _images = imgs;
19                 _type = type;
20                 int gapH = 20;
21                 int gapV = 10;
22                 createSuperpositionPanel();
23
24                 outSizer = new wxFlexGridSizer(1, 1, gapH, gapV);
25                 outSizer -> AddGrowableCol(0);
26                 outSizer -> AddGrowableRow(0);
27                 outSizer->Add( theViewPanel, 1, wxGROW);
28                                                                 
29                 this->SetSizer( outSizer );
30                 this->SetAutoLayout( true );
31                 this->Layout();
32         }
33         
34
35         wxMaracasSuperpositionPanel :: ~wxMaracasSuperpositionPanel()
36         {
37
38         }
39
40         //------------------------------------------------------------------------------------------------------------
41         // Creational and initialization methods
42         //------------------------------------------------------------------------------------------------------------
43         
44         void wxMaracasSuperpositionPanel :: createSuperpositionPanel()
45         {               
46
47                 std::vector<int> * numViews = new std::vector<int> ();
48                 numViews->push_back(0);
49                 
50                 if (_type==1 || _type==3)
51                 {
52                         theViewPanel = new wxMaracas_N_ViewersWidget( this, _images[0], numViews );                     
53                 }
54                 else if (_type==2)
55                 {
56                         theViewPanel = new wxMaracas_N_ViewersWidget( this, _images[1], numViews );                                             
57                 }
58                 
59                 SetVisibleAxis(false);
60
61                 theViewPanel->SetBackgroundColour(wxColour(0,0,0));
62
63                 theViewPanel->SetSize(800, 900);
64                 theViewPanel->GetWindow(1)->SetSize(800, 900);  
65         }
66
67         //------------------------------------------------------------------------------------------------------------
68
69         wxVtkBaseView* wxMaracasSuperpositionPanel :: GetWxVtkBaseView()
70         {
71                 return theViewPanel->GetwxVtkBaseView(1);
72         }
73
74
75         wxVtkMPR2DView * wxMaracasSuperpositionPanel::GetwxVtkMPR2DView() 
76         {
77                 return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
78         }
79
80         vtkImageData * wxMaracasSuperpositionPanel::GetshowingVID() 
81         {
82                 return _images[0];
83         }
84
85         int wxMaracasSuperpositionPanel::GetImageDataSizeZ()
86         {
87                 int ext[6];
88                 GetshowingVID()->GetExtent(ext);
89                 int sizeZ = ext[5]-ext[4]+1;
90
91                 return sizeZ;
92         }
93
94         void wxMaracasSuperpositionPanel :: RefreshInterface()
95         {
96                 GetWxVtkBaseView()->Refresh();
97         }
98
99         void wxMaracasSuperpositionPanel :: ChangeImage(vtkImageData* img)
100         {
101                 theViewPanel->SetImage(img);
102         }
103         
104         //------------------------------------------------------------------------------------------------------------
105         //  Other functional methods
106         //------------------------------------------------------------------------------------------------------------
107
108         void wxMaracasSuperpositionPanel::SetVisibleAxis(bool ok)
109         {
110                 GetwxVtkMPR2DView()->SetVisibleAxis(ok);
111         }
112
113         //------------------------------------------------------------------------------------------------------------
114         int wxMaracasSuperpositionPanel::GetX()
115         {
116                 return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
117         }
118         //------------------------------------------------------------------------------------------------------------
119         int wxMaracasSuperpositionPanel::GetY()
120         {
121                 return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
122         }
123         //------------------------------------------------------------------------------------------------------------
124         int wxMaracasSuperpositionPanel::GetZ()
125         {
126                 return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
127         }
128
129         //------------------------------------------------------------------------------------------------------------
130         void wxMaracasSuperpositionPanel::Refresh()
131         {
132                 GetwxVtkMPR2DView()->GetRenWin()->Render();
133         }
134