Panel class composed of a vtk renderwindow with double click available and add some buttons. More...
#include <wxSurfaceSTLWidget.h>
Panel class composed of a vtk renderwindow with double click available and add some buttons.
Definition at line 31 of file wxSurfaceSTLWidget.h.
Definition at line 34 of file wxSurfaceSTLWidget.h.
00035 { 00036 ID_TOOL_BAR = 300, 00037 ID_BUTTON_NEW_AXIS, 00038 ID_BUTTON_DELETE_AXIS, 00039 ID_CHECKBOX_ISOVISIBLE, 00040 ID_SLIDER_ISOVAL, 00041 ID_SLIDER_OPACITY, 00042 ID_BUTTON_CHOOSE_COLOR, 00043 ID_BUTTON_VESSELS_CONSTRUCTION, 00044 ID_BUTTON_3D_CUTTER, 00045 ID_BUTTON_EXPORT_STL, 00046 ID_CHECKBOX_STL_VISIBLE, 00047 ID_SLIDER_STL_THRESH, 00048 ID_CHECKBOX_INVERT_SLICE_ORDER, 00049 };
Definition at line 50 of file wxSurfaceSTLWidget.h.
00051 { 00052 ID_WORLD3D = 800 00053 };
wxSurfaceSTLWidget::wxSurfaceSTLWidget | ( | wxWindow * | parent, | |
wxWindowID | id = -1 , |
|||
const wxPoint & | pos = wxDefaultPosition , |
|||
const wxSize & | size = wxDefaultSize , |
|||
long | style = wxScrolledWindowStyle , |
|||
const wxString & | name = wxPanelNameStr | |||
) |
Definition at line 53 of file wxSurfaceSTLWidget.cxx.
00054 : wxPanel( parent, id, pos, size, style, name ) 00055 { 00056 _mar = NULL; 00057 00058 _3DWorldSTL = new vtk3DSurfaceSTLWidget( this, ID_WORLD3D ); 00059 00060 // Set up axis toolbar 00061 wxBitmap axisToolBarBitmaps[ 2 ]; 00062 axisToolBarBitmaps[ 0 ] = wxBITMAP( axistoolbar_extract ); 00063 axisToolBarBitmaps[ 1 ] = wxBITMAP( axistoolbar_erase ); 00064 00065 00066 //By default the Iso value is visible. 00067 _isoVisible = new wxCheckBox( this, ID_CHECKBOX_ISOVISIBLE, _T("Iso visible") ); 00068 _isoVisible->SetValue( true ); 00069 _isoValue = new wxSlider( this, ID_SLIDER_ISOVAL, 0, 0, 10000 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS); 00070 _opacity = new wxSlider( this, ID_SLIDER_OPACITY, 0, 0, 100 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS); 00071 _isoValue->SetLabel( _T("IsoValue") ); 00072 _opacity->SetLabel( _T("Surface opacity") ); 00073 00074 //I can't get to brighten the button when mouse over: 00075 //_surface_color = new wxButton(this, ID_BUTTON_CHOOSE_COLOR, "", wxPoint(0,0), wxSize(150,50), wxRAISED_BORDER); 00076 //_surface_color->SetBackgroundColour( wxColour(250, 235, 214)); 00077 00078 // Set up vessels toolbar 00079 wxBitmap vesselsToolBarBitmaps[ 3 ]; 00080 vesselsToolBarBitmaps[ 0 ] = wxBITMAP( vesselstoolbar_extract ); 00081 vesselsToolBarBitmaps[ 1 ] = wxBITMAP( vesselstoolbar_cutter ); 00082 vesselsToolBarBitmaps[ 2 ] = wxBITMAP( vesselstoolbar_stl ); 00083 00084 _vessels_tb = new wxToolBar( this, -1); 00085 _vessels_tb->SetMargins( 4, 4 ); 00086 _vessels_tb->SetToolBitmapSize( wxSize( vesselsToolBarBitmaps[ 0 ].GetWidth( ), vesselsToolBarBitmaps[ 0 ].GetHeight( ) ) ); 00087 _vessels_tb->AddTool(ID_BUTTON_VESSELS_CONSTRUCTION, _T("Construct Surface"), vesselsToolBarBitmaps[ 0 ], _T("Construct Surface")); 00088 _vessels_tb->AddSeparator( ); 00089 //_vessels_tb->AddTool(ID_BUTTON_3D_CUTTER, vesselsToolBarBitmaps[ 1 ], "Delete axis", "short help string"); 00090 _vessels_tb->AddCheckTool(ID_BUTTON_3D_CUTTER, _T("Delete axis"), vesselsToolBarBitmaps[ 1 ], wxNullBitmap, _T("Delete axis") ); //, "short help string" 00091 _vessels_tb->AddSeparator( ); 00092 _vessels_tb->AddTool(ID_BUTTON_EXPORT_STL, _T("Export as STL"), vesselsToolBarBitmaps[ 2 ], _T("Export as STL")); 00093 _vessels_tb->Realize( ); 00094 _vessels_tb->SetRows( 1 ); 00095 00096 00097 //Set Properties: 00098 _isoValue->SetSize(wxSize(64, 16)); 00099 //End set properties 00100 00101 //Do the layout: 00102 wxStaticBoxSizer* sizer_3 = new wxStaticBoxSizer(new wxStaticBox(this, -1, _T("Iso Surface values")), wxVERTICAL); 00103 //Some borders are needed on wxGTK otherwise static text and slider labels collides. 00104 sizer_3->Add(_isoVisible, 1, wxALL|wxEXPAND, 2); 00105 sizer_3->Add(new wxStaticText(this, -1, _T("Isovalue")), 1, wxALL|wxEXPAND, 2); 00106 sizer_3->Add(_isoValue, 1, wxALL|wxEXPAND, 2); 00107 sizer_3->Add(new wxStaticText(this, -1, _T("Opacity (%)")), 1, wxALL|wxEXPAND, 2); 00108 sizer_3->Add(_opacity, 1, wxALL|wxEXPAND, 2); 00109 00110 //By default the STL Iso value is visible. 00111 _stlIntSurfaceVisible = new wxCheckBox( this, ID_CHECKBOX_STL_VISIBLE, _T("Internal STL Surface visible") ); 00112 _stlIntSurfaceVisible->SetValue( true ); 00113 _stlExtSurfaceVisible = new wxCheckBox( this, ID_CHECKBOX_STL_VISIBLE, _T("External STL Surface visible") ); 00114 _stlExtSurfaceVisible->SetValue( true ); 00115 _stlSurfaceValue = new wxSlider( this, ID_SLIDER_STL_THRESH, 0, 0, 100 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS); 00116 _stlSurfaceValue->SetLabel( _T("STL Surface Value") ); 00117 _stlSurfaceValue->SetRange(0, 100); 00118 //hard coded value 'cause thie is still not reachable: (int)_3DWorldSTL->GetSTLThreshold() 00119 _stlSurfaceValue->SetValue( 45 ); //100*.45 remember to multiply by 100 00120 00121 00122 //Do the layout: 00123 wxStaticBoxSizer* sizer_4 = new wxStaticBoxSizer(new wxStaticBox(this, -1, _T("STL Surface values")), wxVERTICAL); 00124 sizer_4->Add(_stlIntSurfaceVisible, 1, wxALL|wxEXPAND, 2); 00125 sizer_4->Add(_stlExtSurfaceVisible, 1, wxALL|wxEXPAND, 2); 00126 sizer_4->Add(new wxStaticText(this, -1, _T("STL Isovalue")), 1, wxALL|wxEXPAND, 2); 00127 sizer_4->Add(_stlSurfaceValue, 1, wxALL|wxEXPAND, 2); 00128 00129 _stlIntSurfaceVisible->Disable(); 00130 _stlExtSurfaceVisible->Disable(); 00131 _stlSurfaceValue->Disable(); 00132 00133 _chkInvertSliceOrder = new wxCheckBox(this, ID_CHECKBOX_INVERT_SLICE_ORDER, _T("Invert slice order")); 00134 00135 wxBoxSizer* sizer_2 = new wxBoxSizer(wxVERTICAL); 00136 sizer_2->Add(sizer_3, 1, wxEXPAND, 0); 00137 // EED Borrame 00138 // sizer_2->Add(_axis_tb, 1, wxEXPAND|wxALL|wxALIGN_LEFT, 0); 00139 sizer_2->Add(sizer_4, 1, wxEXPAND, 0); 00140 sizer_2->Add(_vessels_tb, 1, wxEXPAND|wxALL|wxALIGN_LEFT, 0); 00141 sizer_2->Add(_chkInvertSliceOrder, 1, wxEXPAND|wxALL|wxALIGN_LEFT, 0); 00142 00143 wxBoxSizer* sizer_1 = new wxBoxSizer(wxHORIZONTAL); 00144 sizer_1->Add(_3DWorldSTL, 1, wxEXPAND, 0); 00145 sizer_1->Add(sizer_2, 0, wxALL|wxALIGN_RIGHT, 5); 00146 00147 SetAutoLayout(true); 00148 SetSizer(sizer_1); 00149 Layout(); 00150 00151 }
wxSurfaceSTLWidget::~wxSurfaceSTLWidget | ( | ) |
Definition at line 154 of file wxSurfaceSTLWidget.cxx.
References _3DWorldSTL.
00155 { 00156 _3DWorldSTL->Delete(); 00157 }
wxSurfaceSTLWidget::DECLARE_EVENT_TABLE | ( | ) |
void wxSurfaceSTLWidget::On3DCutter | ( | wxCommandEvent & | event | ) |
Definition at line 284 of file wxSurfaceSTLWidget.cxx.
References _3DWorldSTL, and vtk3DSurfaceSTLWidget::SetCuttingMode().
00285 { 00286 wxBusyCursor wait; 00287 _3DWorldSTL->SetCuttingMode( event.IsChecked() ); 00288 }
void wxSurfaceSTLWidget::OnChooseSurfaceColor | ( | wxCommandEvent & | event | ) |
void wxSurfaceSTLWidget::OnExportAsSTL | ( | wxCommandEvent & | event | ) |
void wxSurfaceSTLWidget::OnInvertSliceOrder | ( | wxCommandEvent & | WXUNUSEDevent | ) |
Definition at line 233 of file wxSurfaceSTLWidget.cxx.
References _chkInvertSliceOrder, _mar, marInterface::_parameters, marParameters::e_invest_slice_order, marInterface::saveParameters(), and marParameters::setBoolParam().
00233 { 00234 wxMessageDialog *msgDlg = new wxMessageDialog(this, _T("You have to restart the application!"), _T("WARNING!!"), wxOK ); 00235 msgDlg->ShowModal(); 00236 delete msgDlg; 00237 _mar->_parameters->setBoolParam( marParameters::e_invest_slice_order, _chkInvertSliceOrder->GetValue( ) ); 00238 _mar->saveParameters( ); 00239 }
void wxSurfaceSTLWidget::OnIsoVisible | ( | wxCommandEvent & | event | ) |
void wxSurfaceSTLWidget::OnSliderIsovalueScrollThumbrelease | ( | wxScrollEvent & | event | ) |
Definition at line 258 of file wxSurfaceSTLWidget.cxx.
References _3DWorldSTL, and vtk3DSurfaceSTLWidget::SetSurfaceIsoValue().
00259 { 00260 wxBusyCursor wait; 00261 _3DWorldSTL->SetSurfaceIsoValue( event.GetPosition() ); 00262 }
void wxSurfaceSTLWidget::OnSliderOpacityScrollThumbrelease | ( | wxScrollEvent & | event | ) |
Definition at line 264 of file wxSurfaceSTLWidget.cxx.
References _3DWorldSTL, and vtk3DSurfaceSTLWidget::SetSurfaceOpacity().
00265 { 00266 _3DWorldSTL->SetSurfaceOpacity( event.GetPosition() ); 00267 }
void wxSurfaceSTLWidget::OnSliderSTLSurfaceValueThumbrelease | ( | wxScrollEvent & | event | ) |
void wxSurfaceSTLWidget::OnSTLSurfaceVisible | ( | wxCommandEvent & | event | ) |
void wxSurfaceSTLWidget::OnVesselConstruction | ( | wxCommandEvent & | event | ) |
void wxSurfaceSTLWidget::ShowMARACASData | ( | marInterface * | mar | ) |
Definition at line 177 of file wxSurfaceSTLWidget.cxx.
References _3DWorldSTL, _chkInvertSliceOrder, marInterface::_experiment, _isoValue, _mar, _opacity, marInterface::_parameters, marParameters::e_invest_slice_order, marParameters::getBoolParam(), marExperiment::getDynData(), marDynData::getVolume(), min, and vtk3DSurfaceSTLWidget::ShowMARACASDataAndAxe().
00178 { 00179 wxBusyCursor wait; 00180 00181 00182 // _width = _mar->_experiment->getDynData( )->getVolume( )->getWidth( ); 00183 // _height = _mar->_experiment->getDynData( )->getVolume( )->getHeight( ); 00184 // _depth = _mar->_experiment->getDynData( )->getVolume( )->getDepth( ); 00185 00186 00187 double min, max; //backward compatibility 00188 00189 _mar = mar; 00190 //_3DWorldSTL->_mar = mar; 00191 // _3DWorldSTL->ShowMARACASData( mar ); 00192 _3DWorldSTL->ShowMARACASDataAndAxe( mar ); 00193 00194 00195 //GUI stuff: 00196 _mar->_experiment->getDynData( )->getVolume( )->getMinMax( min, max ); 00197 00198 _isoValue->SetRange((int)min, (int)max); 00199 _isoValue->SetValue( (int)(max/4) ); 00200 00201 _opacity->SetValue( 50 ); 00202 _chkInvertSliceOrder->SetValue( _mar->_parameters->getBoolParam( marParameters::e_invest_slice_order ) ); 00203 00204 }
Definition at line 106 of file wxSurfaceSTLWidget.h.
Referenced by On3DCutter(), OnSliderIsovalueScrollThumbrelease(), OnSliderOpacityScrollThumbrelease(), ShowMARACASData(), and ~wxSurfaceSTLWidget().
wxToolBar* wxSurfaceSTLWidget::_axis_tb |
Definition at line 93 of file wxSurfaceSTLWidget.h.
wxCheckBox* wxSurfaceSTLWidget::_chkInvertSliceOrder |
Definition at line 102 of file wxSurfaceSTLWidget.h.
Referenced by OnInvertSliceOrder(), and ShowMARACASData().
wxSlider* wxSurfaceSTLWidget::_isoValue |
Definition at line 96 of file wxSurfaceSTLWidget.h.
Referenced by ShowMARACASData().
wxCheckBox* wxSurfaceSTLWidget::_isoVisible |
Definition at line 95 of file wxSurfaceSTLWidget.h.
Definition at line 104 of file wxSurfaceSTLWidget.h.
Referenced by OnInvertSliceOrder(), and ShowMARACASData().
wxSlider* wxSurfaceSTLWidget::_opacity |
Definition at line 97 of file wxSurfaceSTLWidget.h.
Referenced by ShowMARACASData().
wxCheckBox* wxSurfaceSTLWidget::_stlExtSurfaceVisible |
Definition at line 100 of file wxSurfaceSTLWidget.h.
wxCheckBox* wxSurfaceSTLWidget::_stlIntSurfaceVisible |
Definition at line 99 of file wxSurfaceSTLWidget.h.
wxSlider* wxSurfaceSTLWidget::_stlSurfaceValue |
Definition at line 101 of file wxSurfaceSTLWidget.h.
wxButton* wxSurfaceSTLWidget::_surface_color |
Definition at line 98 of file wxSurfaceSTLWidget.h.
wxToolBar* wxSurfaceSTLWidget::_vessels_tb |
Definition at line 94 of file wxSurfaceSTLWidget.h.