]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/wxMaracas_ManualContour_Panel.cxx
*** empty log message ***
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / wxMaracas_ManualContour_Panel.cxx
1 /*=========================================================================
2
3   Program:   wxMaracas
4   Module:    $RCSfile: wxMaracas_ManualContour_Panel.cxx,v $
5   Language:  C++
6   Date:      $Date: 2008/10/31 16:32:11 $
7   Version:   $Revision: 1.1 $
8
9   Copyright: (c) 2002, 2003
10   License:
11
12      This software is distributed WITHOUT ANY WARRANTY; without even
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14      PURPOSE.  See the above copyright notice for more information.
15
16 =========================================================================*/
17
18
19 #include <wx/splitter.h>
20 #include "widgets/pPlotter/mBarRange.h"
21 #include "wxMaracas_ManualContour_Panel.h"
22
23
24 BEGIN_EVENT_TABLE( wxMaracas_ManualContour_Panel, wxPanel )
25         EVT_MENU( 12121, wxMaracas_ManualContour_Panel::OnRefreshView )
26 END_EVENT_TABLE( );
27
28
29 wxMaracas_ManualContour_Panel::wxMaracas_ManualContour_Panel( wxWindow* parent  )
30 : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
31 {
32   // Create the main frame window
33
34   wxWindow *wxwindow = CreateViewerPanel(this);
35   wxBoxSizer* szTop = new wxBoxSizer( wxVERTICAL );
36   szTop->Add( wxwindow, 1  , wxEXPAND |  wxALL , 0 );
37   szTop->Fit( this );
38   szTop->SetSizeHints( this );
39   this->SetAutoLayout( true );
40   this->SetSizer( szTop );
41   this->Layout();
42 }
43 //----------------------------------------------------------------------------
44 wxMaracas_ManualContour_Panel::~wxMaracas_ManualContour_Panel( )
45 {
46   // Nothing
47 }
48 //----------------------------------------------------------------------------
49 void wxMaracas_ManualContour_Panel::ConfigureVTK( marImageData *marimagedata )
50 {
51         vtkMPRBaseData  *vtkmprbasedata  = new vtkMPRBaseData();
52         vtkmprbasedata->SetMarImageData(marimagedata);
53         vtkmprbasedata->SetX(5);
54         vtkmprbasedata->SetY(5);
55         vtkmprbasedata->SetZ(5);
56 //      _vtkplane2Dview->SetVtkBaseData( vtkmprbasedata );
57 //      _vtkplane2Dview->Configure();
58 }
59
60 //----------------------------------------------------------------------------
61 void wxMaracas_ManualContour_Panel::OnRefreshView( wxCommandEvent & event)
62 {
63         _vtkplane2Dview->Refresh();
64         _vtkplane2Dview->RefreshView();
65 }
66
67 //----------------------------------------------------------------------------
68
69 void wxMaracas_ManualContour_Panel::OnActualChange(wxCommandEvent& event)
70 {
71 //      wxMessageDialog(this, _T("EED: OnActualChange")).ShowModal();
72 }
73
74
75 //----------------------------------------------------------------------------
76 wxWindow* wxMaracas_ManualContour_Panel::CreateViewerPanel(wxWindow* parent)
77 {
78         wxPanel *panel =  new wxPanel(parent,-1);
79 /*
80         // Panel Up Bar
81         wxPanel *panelUpBar = new wxPanel(panel,-1);
82
83                 int Tmin=0,Tmax=34;
84                 mBarRange *time_barrange = new mBarRange(panelUpBar,400,10);
85                 time_barrange -> setVisibleLabels(true);
86                 time_barrange -> setRepresentedValues (Tmin,Tmax);
87                 time_barrange -> setDeviceBlitStart (0,0);
88                 time_barrange -> SetActual((Tmin+Tmax)/2);
89                 time_barrange -> setActiveStateTo(true);
90                 time_barrange -> SetInRangeProperty(false);
91                 Connect(time_barrange->GetId(),wxEVT_TSBAR_ACTUAL  , (wxObjectEventFunction) &wxMaracas_ManualContour_Panel::OnActualChange,NULL,this);
92
93         wxBoxSizer *sizerUpBar= new wxBoxSizer(wxHORIZONTAL);
94         wxPanel *tmpPanel = new wxPanel(panel,-1, wxDefaultPosition , wxSize(50,50) );
95         sizerUpBar->Add( tmpPanel);
96         sizerUpBar->Add( time_barrange  , 1, wxEXPAND, 10 );
97         sizerUpBar->SetSizeHints( panelUpBar );   // set size hints to honour minimum size
98         panelUpBar->SetSizer(sizerUpBar);
99         panelUpBar->SetAutoLayout(true);
100         panelUpBar->Layout(); 
101
102
103 // Down
104         // Panel Down Bar
105         wxPanel *panelDownBar = new wxPanel(panel,-1);
106
107                 //z bar
108                 int Zmin = 0 , Zmax = 34;
109                 mBarRange *z_barrange = new mBarRange(panelDownBar,50,400);
110                 z_barrange -> SetBackgroundColour( wxColour(100,100,0) );
111                 z_barrange -> SetOrientation(false);
112                 z_barrange -> setVisibleLabels(true);
113                 z_barrange -> setRepresentedValues (Zmin,Zmax);
114         //      z_barrange -> SetActual((min+max)/2);
115                 z_barrange -> setDeviceBlitStart (0,0);
116                 z_barrange -> setActiveStateTo(true);
117                 z_barrange -> SetInRangeProperty(false);
118                 Connect(z_barrange->GetId(),wxEVT_TSBAR_ACTUAL  , (wxObjectEventFunction) &wxMaracas_ManualContour_Panel::OnActualChange,NULL,this);
119
120
121         wxFlexGridSizer *sizerDownBar   = new wxFlexGridSizer(5);
122         sizerDownBar->AddGrowableCol(2);
123         sizerDownBar->AddGrowableRow(0);
124
125         //tmp slider
126         wxSlider *tmpSlider                             = new wxSlider(panelDownBar,-1,0,0,100,wxDefaultPosition,wxSize(50,50),wxSL_VERTICAL);
127         sizerDownBar->Add( tmpSlider    , 1     , wxEXPAND|wxALIGN_BOTTOM , 10 );
128
129         sizerDownBar->Add( z_barrange   , 1     , wxEXPAND| wxALIGN_BOTTOM, 10 );
130
131         sizerDownBar->Add( CreateSplitePanel(panelDownBar)      , 1 , wxGROW , 10 );
132         sizerDownBar->SetSizeHints( panelDownBar );   // set size hints to honour minimum size
133         panelDownBar->SetSizer(sizerDownBar);
134         panelDownBar->SetAutoLayout(true);
135         panelDownBar->Layout(); 
136
137         wxBoxSizer *sizer= new wxBoxSizer(wxVERTICAL);
138         sizer->Add( panelUpBar          , 0 , wxEXPAND , 10);
139         sizer->Add( panelDownBar        , 1 , wxEXPAND, 10 );
140
141         sizer->SetSizeHints( panel );   // set size hints to honour minimum size
142         panel->SetSizer(sizer);
143         panel->SetAutoLayout(true);
144         panel->Layout(); 
145 */
146         return panel;
147 }
148
149 //----------------------------------------------------------------------------
150 wxWindow* wxMaracas_ManualContour_Panel::CreateSplitePanel(wxWindow *parent)
151 {
152         // Spliter
153         wxSplitterWindow *splitter      = new wxSplitterWindow(parent,-1);
154
155         // Plane Widget
156         _vtkplane2Dview                         = new vtkPlane2DView( splitter );
157         _vtkplane2Dview->SetImgSize( 350 );
158         wxWindow *pA = _vtkplane2Dview->GetWxVTKRenderWindowInteractor ();
159
160         wxPanel *pB = new wxPanel(splitter,-1);
161         pA->SetBackgroundColour( wxColour(255,0,0) );
162         pB->SetBackgroundColour( wxColour(0,0,255) );
163         splitter->SplitVertically( pA , pB );
164         return splitter;
165 }
166
167 //----------------------------------------------------------------------------
168 //----------------------------------------------------------------------------
169 //----------------------------------------------------------------------------
170
171
172
173
174
175 // EOF - wxMaracas_ManualContour_Panel.cxx