]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSuperpositionPanel.cxx
*** empty log message ***
[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, 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                 int gapH = 20;
20                 int gapV = 10;
21                 createSuperpositionPanel();
22
23                 outSizer = new wxFlexGridSizer(1, 1, gapH, gapV);
24                 outSizer -> AddGrowableCol(0);
25                 outSizer -> AddGrowableRow(0);
26                 outSizer->Add( theViewPanel, 1, wxGROW);
27                                                                 
28                 this->SetSizer( outSizer );
29                 this->SetAutoLayout( true );
30                 this->Layout();
31         }
32         
33
34         wxMaracasSuperpositionPanel :: ~wxMaracasSuperpositionPanel()
35         {
36
37         }
38
39         //------------------------------------------------------------------------------------------------------------
40         // Creational and initialization methods
41         //------------------------------------------------------------------------------------------------------------
42         
43         void wxMaracasSuperpositionPanel :: createSuperpositionPanel()
44         {               
45
46                 std::vector<int> * numViews = new std::vector<int> ();
47                 numViews->push_back(0);
48                 theViewPanel = new wxMaracas_N_ViewersWidget( this, _images[0], numViews );
49                 SetVisibleAxis(false);
50
51                 theViewPanel->SetBackgroundColour(wxColour(0,0,0));
52
53                 theViewPanel->SetSize(800, 900);
54                 theViewPanel->GetWindow(1)->SetSize(800, 900);  
55         }
56
57         //------------------------------------------------------------------------------------------------------------
58
59         wxVtkBaseView* wxMaracasSuperpositionPanel :: GetWxVtkBaseView()
60         {
61                 return theViewPanel->GetwxVtkBaseView(1);
62         }
63
64
65         wxVtkMPR2DView * wxMaracasSuperpositionPanel::GetwxVtkMPR2DView() 
66         {
67                 return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
68         }
69
70         vtkImageData * wxMaracasSuperpositionPanel::GetshowingVID() 
71         {
72                 return _images[0];
73         }
74
75         int wxMaracasSuperpositionPanel::GetImageDataSizeZ()
76         {
77                 int ext[6];
78                 GetshowingVID()->GetExtent(ext);
79                 int sizeZ = ext[5]-ext[4]+1;
80
81                 return sizeZ;
82         }
83
84         void wxMaracasSuperpositionPanel :: RefreshInterface()
85         {
86                 GetWxVtkBaseView()->Refresh();
87         }
88
89         void wxMaracasSuperpositionPanel :: ChangeImage(vtkImageData* img)
90         {
91                 theViewPanel->SetImage(img);
92         }
93         
94         //------------------------------------------------------------------------------------------------------------
95         //  Other functional methods
96         //------------------------------------------------------------------------------------------------------------
97
98         void wxMaracasSuperpositionPanel::SetVisibleAxis(bool ok)
99         {
100                 GetwxVtkMPR2DView()->SetVisibleAxis(ok);
101         }
102
103         //------------------------------------------------------------------------------------------------------------
104         int wxMaracasSuperpositionPanel::GetX()
105         {
106                 return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
107         }
108         //------------------------------------------------------------------------------------------------------------
109         int wxMaracasSuperpositionPanel::GetY()
110         {
111                 return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
112         }
113         //------------------------------------------------------------------------------------------------------------
114         int wxMaracasSuperpositionPanel::GetZ()
115         {
116                 return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
117         }
118
119         //------------------------------------------------------------------------------------------------------------
120         void wxMaracasSuperpositionPanel::Refresh()
121         {
122                 GetwxVtkMPR2DView()->GetRenWin()->Render();
123         }