1 /*=========================================================================
4 Module: $RCSfile: wxMaracas_ManualContour_Panel.cxx,v $
6 Date: $Date: 2008/10/31 16:32:11 $
7 Version: $Revision: 1.1 $
9 Copyright: (c) 2002, 2003
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.
16 =========================================================================*/
19 #include <wx/splitter.h>
20 #include "widgets/pPlotter/mBarRange.h"
21 #include "wxMaracas_ManualContour_Panel.h"
24 BEGIN_EVENT_TABLE( wxMaracas_ManualContour_Panel, wxPanel )
25 EVT_MENU( 12121, wxMaracas_ManualContour_Panel::OnRefreshView )
29 wxMaracas_ManualContour_Panel::wxMaracas_ManualContour_Panel( wxWindow* parent )
30 : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
32 // Create the main frame window
34 wxWindow *wxwindow = CreateViewerPanel(this);
35 wxBoxSizer* szTop = new wxBoxSizer( wxVERTICAL );
36 szTop->Add( wxwindow, 1 , wxEXPAND | wxALL , 0 );
38 szTop->SetSizeHints( this );
39 this->SetAutoLayout( true );
40 this->SetSizer( szTop );
43 //----------------------------------------------------------------------------
44 wxMaracas_ManualContour_Panel::~wxMaracas_ManualContour_Panel( )
48 //----------------------------------------------------------------------------
49 void wxMaracas_ManualContour_Panel::ConfigureVTK( marImageData *marimagedata )
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();
60 //----------------------------------------------------------------------------
61 void wxMaracas_ManualContour_Panel::OnRefreshView( wxCommandEvent & event)
63 _vtkplane2Dview->Refresh();
64 _vtkplane2Dview->RefreshView();
67 //----------------------------------------------------------------------------
69 void wxMaracas_ManualContour_Panel::OnActualChange(wxCommandEvent& event)
71 // wxMessageDialog(this, _T("EED: OnActualChange")).ShowModal();
75 //----------------------------------------------------------------------------
76 wxWindow* wxMaracas_ManualContour_Panel::CreateViewerPanel(wxWindow* parent)
78 wxPanel *panel = new wxPanel(parent,-1);
81 wxPanel *panelUpBar = new wxPanel(panel,-1);
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);
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();
105 wxPanel *panelDownBar = new wxPanel(panel,-1);
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);
121 wxFlexGridSizer *sizerDownBar = new wxFlexGridSizer(5);
122 sizerDownBar->AddGrowableCol(2);
123 sizerDownBar->AddGrowableRow(0);
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 );
129 sizerDownBar->Add( z_barrange , 1 , wxEXPAND| wxALIGN_BOTTOM, 10 );
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();
137 wxBoxSizer *sizer= new wxBoxSizer(wxVERTICAL);
138 sizer->Add( panelUpBar , 0 , wxEXPAND , 10);
139 sizer->Add( panelDownBar , 1 , wxEXPAND, 10 );
141 sizer->SetSizeHints( panel ); // set size hints to honour minimum size
142 panel->SetSizer(sizer);
143 panel->SetAutoLayout(true);
149 //----------------------------------------------------------------------------
150 wxWindow* wxMaracas_ManualContour_Panel::CreateSplitePanel(wxWindow *parent)
153 wxSplitterWindow *splitter = new wxSplitterWindow(parent,-1);
156 _vtkplane2Dview = new vtkPlane2DView( splitter );
157 _vtkplane2Dview->SetImgSize( 350 );
158 wxWindow *pA = _vtkplane2Dview->GetWxVTKRenderWindowInteractor ();
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 );
167 //----------------------------------------------------------------------------
168 //----------------------------------------------------------------------------
169 //----------------------------------------------------------------------------
175 // EOF - wxMaracas_ManualContour_Panel.cxx