#include <CutModelView.h>
Public Member Functions | |
CutModelView (wxWindow *parent, double *range) | |
~CutModelView () | |
virtual void | Execute (vtkObject *wdg, unsigned long eventId, void *calldata) |
int | getId () |
void | setId (int id) |
void | ExecuteCut () |
void | SetCurrentColor (wxColour colour) |
Private Member Functions | |
double * | getRange () |
bool | isCut () |
bool | isInside () |
wxSizer * | getBoxControls (wxWindow *parent, double *range) |
wxSizer * | getActorProperties (wxWindow *parent) |
wxSizer * | getColorChooseActor (wxWindow *parent) |
wxSizer * | getOpacityActor (wxWindow *parent) |
void | checkInvariant () throw ( CutModelException) |
Private Attributes | |
int | _id |
wxSlider * | _sliderrange |
wxRadioBox * | _radioinsideout |
wxStaticText * | _currentcolor |
Definition at line 36 of file CutModelView.h.
CutModelView::CutModelView | ( | wxWindow * | parent, | |
double * | range | |||
) |
Definition at line 37 of file CutModelView.cxx.
References getActorProperties(), getBoxControls(), and CutModelViewEventHandler::onExecute().
00038 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){ 00039 00040 wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); 00041 00042 this->SetSizer(sizer); 00043 00044 sizer->Add(getBoxControls(this, range),wxSizerFlags().FixedMinSize()); 00045 00046 sizer->AddSpacer(5); 00047 00048 sizer->Add(getActorProperties(this),wxSizerFlags().FixedMinSize()); 00049 00050 00051 wxBitmap bitmapok(Ok1_xpm); 00052 wxBitmapButton* okbutton = new wxBitmapButton(this, -1, bitmapok,wxDefaultPosition,wxSize(30,30)); 00053 Connect(okbutton->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)(&CutModelViewEventHandler::onExecute)); 00054 00055 sizer->AddSpacer(5); 00056 sizer->Add(okbutton,wxSizerFlags().FixedMinSize()); 00057 00058 00059 00060 00061 00062 }
CutModelView::~CutModelView | ( | ) |
Definition at line 63 of file CutModelView.cxx.
References getId(), CutModelMainPanel::getInstance(), and CutModelMainPanel::RemoveActor().
00063 { 00064 CutModelMainPanel::getInstance()->RemoveActor(this->getId()); 00065 }
void CutModelView::checkInvariant | ( | ) | throw ( CutModelException) [private] |
Definition at line 158 of file CutModelView.cxx.
void CutModelView::Execute | ( | vtkObject * | wdg, | |
unsigned long | eventId, | |||
void * | calldata | |||
) | [virtual] |
Definition at line 162 of file CutModelView.cxx.
References getId(), CutModelMainPanel::getInstance(), CutModelMainPanel::ShowCurrentPanel(), CutModelMainPanel::ShowPopUpMenu(), and CutModelMainPanel::updateActorDirection().
00162 { // virtual 00163 //vtkBoxWidget *boxwidget = reinterpret_cast<vtkBoxWidget*>(wdg); 00164 00165 if(eventId==vtkCommand::StartInteractionEvent){ 00166 CutModelMainPanel::getInstance()->ShowCurrentPanel(this->getId()); 00167 }else if(eventId==vtkCommand::InteractionEvent){ 00168 CutModelMainPanel::getInstance()->updateActorDirection(this->getId()); 00169 }else if(eventId==vtkCommand::RightButtonReleaseEvent){ 00170 // =( 00171 CutModelMainPanel::getInstance()->ShowPopUpMenu(this->getId()); 00172 } 00173 }
void CutModelView::ExecuteCut | ( | ) |
Definition at line 175 of file CutModelView.cxx.
References CutModelMainPanel::ExecuteCut(), getId(), CutModelMainPanel::getInstance(), getRange(), isCut(), and isInside().
Referenced by CutModelViewEventHandler::onExecute().
00175 { 00176 if(this->isCut()){ 00177 CutModelMainPanel::getInstance()->ExecuteCut(this->getId(),this->getRange(),this->isInside()); 00178 }else{ 00179 } 00180 00181 }
wxSizer * CutModelView::getActorProperties | ( | wxWindow * | parent | ) | [private] |
Definition at line 113 of file CutModelView.cxx.
References getColorChooseActor(), and getOpacityActor().
Referenced by CutModelView().
00113 { 00114 00115 wxBoxSizer* sizeractorproperties = new wxBoxSizer(wxVERTICAL); 00116 00117 wxStaticText* labelshapeactor = new wxStaticText(parent, -1, wxString(_T("Actor's properties"))); 00118 00119 sizeractorproperties->Add(labelshapeactor,wxSizerFlags().FixedMinSize()); 00120 00121 sizeractorproperties->Add(getColorChooseActor(parent),wxSizerFlags().FixedMinSize()); 00122 00123 sizeractorproperties->Add(getOpacityActor(parent),wxSizerFlags().FixedMinSize()); 00124 00125 return sizeractorproperties; 00126 00127 }
wxSizer * CutModelView::getBoxControls | ( | wxWindow * | parent, | |
double * | range | |||
) | [private] |
Definition at line 67 of file CutModelView.cxx.
References _radioinsideout, _sliderrange, CutModelViewEventHandler::onShapeChange(), CutModelViewEventHandler::onStatistics(), and CutModelViewEventHandler::onViewBoxChecked().
Referenced by CutModelView().
00067 { 00068 00069 wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); 00070 wxCheckBox* checkbox = new wxCheckBox(parent,-1,_T("View Box")); 00071 sizer->Add(checkbox,wxSizerFlags().FixedMinSize()); 00072 checkbox->SetValue(true); 00073 Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)(&CutModelViewEventHandler::onViewBoxChecked)); 00074 00075 wxString choices1[3]; 00076 //choices1[0] = _T("Select a shape..."); 00077 choices1[0] = _T("Sphere"); 00078 choices1[1] = _T("Cylinder"); 00079 choices1[2] = _T("Cube"); 00080 wxComboBox* combo = new wxComboBox(parent, -1,_T(""),wxDefaultPosition,wxDefaultSize,3,choices1); 00081 combo->SetValue(_T("Sphere")); 00082 sizer->Add(combo,wxSizerFlags().FixedMinSize()); 00083 Connect(combo->GetId(), wxEVT_COMMAND_COMBOBOX_SELECTED,(wxObjectEventFunction)(&CutModelViewEventHandler::onShapeChange)); 00084 00085 wxStaticText* labelgreyv = new wxStaticText(parent, -1, wxString(_T("Grey value range"))); 00086 _sliderrange = new wxSlider(parent, -1, range[0],range[0],range[1],wxDefaultPosition,wxDefaultSize,wxSL_LABELS|wxSL_SELRANGE); 00087 wxBoxSizer* sizergreyv = new wxBoxSizer(wxVERTICAL); 00088 sizergreyv->Add(labelgreyv,wxSizerFlags().FixedMinSize()); 00089 sizergreyv->Add(_sliderrange,wxSizerFlags().FixedMinSize()); 00090 sizer->Add(sizergreyv,wxSizerFlags().FixedMinSize().Border()); 00091 00092 wxString choices0[2]; 00093 choices0[0] = _T("inside"); 00094 choices0[1] = _T("outside"); 00095 _radioinsideout = new wxRadioBox(parent,-1,_T(""), wxDefaultPosition, wxDefaultSize,2,choices0); 00096 sizer->Add(_radioinsideout,wxSizerFlags().FixedMinSize()); 00097 00098 /*wxString choices[2]; 00099 choices[0] = _T("Cut"); 00100 choices[1] = _T("Statistics"); 00101 _radiocutstat = new wxRadioBox(parent,-1,_T(""), wxDefaultPosition, wxDefaultSize,2,choices); 00102 sizer->Add(_radiocutstat,wxSizerFlags().FixedMinSize());*/ 00103 00104 wxBitmap bitmap(Statistics_xpm); 00105 wxBitmapButton* statbut = new wxBitmapButton(parent, -1, bitmap,wxDefaultPosition,wxSize(30,30)); 00106 Connect(statbut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)(&CutModelViewEventHandler::onStatistics)); 00107 sizer->Add(statbut,wxSizerFlags().FixedMinSize()); 00108 00109 00110 00111 return sizer; 00112 }
wxSizer * CutModelView::getColorChooseActor | ( | wxWindow * | parent | ) | [private] |
Definition at line 142 of file CutModelView.cxx.
References _currentcolor, CutModelViewEventHandler::onColorChange(), and SetCurrentColor().
Referenced by getActorProperties().
00142 { 00143 wxBoxSizer* sizercolor = new wxBoxSizer(wxHORIZONTAL); 00144 wxBitmap bitmap(Color_xpm); 00145 wxBitmapButton* colorchoose = new wxBitmapButton(parent, -1, bitmap,wxDefaultPosition,wxSize(30,30)); 00146 wxObjectEventFunction f = (wxObjectEventFunction)(&CutModelViewEventHandler::onColorChange); 00147 Connect(colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, f); 00148 00149 _currentcolor = new wxStaticText(parent,-1,_T(""),wxDefaultPosition,wxSize(20,20)); 00150 this->SetCurrentColor(wxColour(255.0,0.0,0.0)); 00151 00152 sizercolor->Add(colorchoose,wxSizerFlags().FixedMinSize()); 00153 sizercolor->AddSpacer(5); 00154 sizercolor->Add(_currentcolor,wxSizerFlags().FixedMinSize().Centre()); 00155 return sizercolor; 00156 }
int CutModelView::getId | ( | ) | [inline] |
Definition at line 45 of file CutModelView.h.
Referenced by CutModelMainPanel::addNewViewPanel(), Execute(), ExecuteCut(), CutModelViewEventHandler::onColorChange(), CutModelViewEventHandler::onOpacityChange(), CutModelViewEventHandler::onShapeChange(), CutModelViewEventHandler::onStatistics(), CutModelViewEventHandler::onViewBoxChecked(), CutModelMainPanel::RemoveActor(), and ~CutModelView().
00045 { 00046 return _id; 00047 }
wxSizer * CutModelView::getOpacityActor | ( | wxWindow * | parent | ) | [private] |
Definition at line 129 of file CutModelView.cxx.
References CutModelViewEventHandler::onOpacityChange().
Referenced by getActorProperties().
00129 { 00130 wxBoxSizer* sizeropacity = new wxBoxSizer(wxVERTICAL); 00131 00132 wxStaticText* labelopacity = new wxStaticText(parent, -1, wxString(_T("Opacity"))); 00133 wxSlider* slider0 = new wxSlider(parent, -1, 60,0,100,wxDefaultPosition,wxDefaultSize,wxSL_LABELS); 00134 Connect(slider0->GetId(), wxEVT_SCROLL_THUMBRELEASE,(wxObjectEventFunction)(&CutModelViewEventHandler::onOpacityChange)); 00135 00136 sizeropacity->Add(labelopacity,wxSizerFlags().FixedMinSize()); 00137 sizeropacity->Add(slider0,wxSizerFlags().FixedMinSize()); 00138 00139 return sizeropacity; 00140 }
double * CutModelView::getRange | ( | ) | [private] |
Definition at line 183 of file CutModelView.cxx.
References _sliderrange.
Referenced by ExecuteCut().
00183 { 00184 double* x = new double[3]; 00185 x[0] = 0; 00186 x[1] = _sliderrange->GetValue(); 00187 x[2] = 100000; 00188 00189 return x; 00190 }
bool CutModelView::isCut | ( | ) | [private] |
Definition at line 191 of file CutModelView.cxx.
Referenced by ExecuteCut().
bool CutModelView::isInside | ( | ) | [private] |
Definition at line 195 of file CutModelView.cxx.
References _radioinsideout.
Referenced by ExecuteCut().
00195 { 00196 return _radioinsideout->GetSelection()==0; 00197 }
void CutModelView::SetCurrentColor | ( | wxColour | colour | ) |
Definition at line 198 of file CutModelView.cxx.
References _currentcolor.
Referenced by getColorChooseActor(), and CutModelViewEventHandler::onColorChange().
00198 { 00199 _currentcolor->SetBackgroundColour(colour); 00200 00201 this->Refresh(); 00202 this->Layout(); 00203 }
void CutModelView::setId | ( | int | id | ) | [inline] |
Definition at line 48 of file CutModelView.h.
Referenced by CutModelMainPanel::addNewViewPanel().
00048 { 00049 _id = id; 00050 }
wxStaticText* CutModelView::_currentcolor [private] |
Definition at line 63 of file CutModelView.h.
Referenced by getColorChooseActor(), and SetCurrentColor().
int CutModelView::_id [private] |
Definition at line 58 of file CutModelView.h.
wxRadioBox* CutModelView::_radioinsideout [private] |
Definition at line 61 of file CutModelView.h.
Referenced by getBoxControls(), and isInside().
wxSlider* CutModelView::_sliderrange [private] |
Definition at line 60 of file CutModelView.h.
Referenced by getBoxControls(), and getRange().