#include <PlaneDirectionViewerPanel.h>
Public Member Functions | |
PlaneDirectionViewerPanel (wxWindow *parent, PlaneDirectionManagerData *data, int index) | |
~PlaneDirectionViewerPanel () | |
void | onCheckBoxChange (wxCommandEvent &event) |
void | onColorChange (wxCommandEvent &event) |
Private Attributes | |
int | _index |
wxCheckBox * | checkbox |
wxBitmapButton * | _colorchoose |
Definition at line 7 of file PlaneDirectionViewerPanel.h.
PlaneDirectionViewerPanel::PlaneDirectionViewerPanel | ( | wxWindow * | parent, | |
PlaneDirectionManagerData * | data, | |||
int | index | |||
) |
Definition at line 12 of file PlaneDirectionViewerPanel.cxx.
References _colorchoose, _index, checkbox, PlaneDirectionManagerData::GetDirection(), PlaneDirectionManagerData::getPoint0(), PlaneDirectionManagerData::getPoint1(), PlaneDirectionManagerData::getPoint2(), onCheckBoxChange(), and onColorChange().
00013 :wxPanel(parent,-1, wxDefaultPosition, wxDefaultSize,wxBORDER_SUNKEN){ 00014 wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); 00015 00016 _index = index; 00017 this->SetSizer(sizer); 00018 00019 checkbox = new wxCheckBox(this,-1,wxString(_T("Show Actor"))); 00020 checkbox->SetValue(true); 00021 Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&PlaneDirectionViewerPanel::onCheckBoxChange); 00022 00023 wxBitmap bitmap(Color_xpm); 00024 _colorchoose = new wxBitmapButton(this, -1, bitmap,wxDefaultPosition,wxSize(30,30)); 00025 Connect(_colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&PlaneDirectionViewerPanel::onColorChange); 00026 00027 00028 double* p0 = data->getPoint0(); 00029 double* p1 = data->getPoint1(); 00030 double* p2 = data->getPoint2(); 00031 double* dir = data->GetDirection(); 00032 00033 wxString label(_T("[x, y, z]")); 00034 wxString tempstr0; 00035 tempstr0.Printf(_T("P1 [%f, %f, %f"),p0[0],p0[1],p0[2]); 00036 wxString tempstr1; 00037 tempstr1.Printf(_T("P2 [%f, %f, %f"),p1[0],p1[1],p1[2]); 00038 wxString tempstr2; 00039 tempstr2.Printf(_T("P3 [%f, %f, %f"),p2[0],p2[1],p2[2]); 00040 wxString tempstr3; 00041 tempstr3.Printf(_T("Direction [%f, %f, %f"),dir[0],dir[1],dir[2]); 00042 00043 wxStaticText* textlabel = new wxStaticText(this, -1, label); 00044 wxStaticText* textp0 = new wxStaticText(this, -1, tempstr0); 00045 wxStaticText* textp1 = new wxStaticText(this, -1, tempstr1); 00046 wxStaticText* textp2 = new wxStaticText(this, -1, tempstr2); 00047 wxStaticText* textp3 = new wxStaticText(this, -1, tempstr3); 00048 00049 00050 sizer->Add(checkbox,1); 00051 sizer->Add(_colorchoose,1); 00052 sizer->Add(textlabel,1); 00053 sizer->Add(textp0,1); 00054 sizer->Add(textp1,1); 00055 sizer->Add(textp2,1); 00056 sizer->Add(textp3,1); 00057 00058 this->SetAutoLayout(true); 00059 this->Layout(); 00060 00061 }
PlaneDirectionViewerPanel::~PlaneDirectionViewerPanel | ( | ) |
Definition at line 84 of file PlaneDirectionViewerPanel.cxx.
void PlaneDirectionViewerPanel::onCheckBoxChange | ( | wxCommandEvent & | event | ) |
Definition at line 63 of file PlaneDirectionViewerPanel.cxx.
References _index, PlaneDirectionViewer::addRemoveActor(), checkbox, and PlaneDirectionViewer::getInstance().
Referenced by PlaneDirectionViewerPanel().
00063 { 00064 PlaneDirectionViewer::getInstance()->addRemoveActor(this->_index, checkbox->GetValue()); 00065 }
void PlaneDirectionViewerPanel::onColorChange | ( | wxCommandEvent & | event | ) |
Definition at line 67 of file PlaneDirectionViewerPanel.cxx.
References _colorchoose, _index, PlaneDirectionViewer::changeColor(), and PlaneDirectionViewer::getInstance().
Referenced by PlaneDirectionViewerPanel().
00067 { 00068 00069 wxColourDialog* colourdiag = new wxColourDialog(this); 00070 if(colourdiag->ShowModal()==wxID_OK){ 00071 wxColour colour = colourdiag->GetColourData().GetColour(); 00072 _colorchoose->SetBackgroundColour(colour); 00073 00074 double r = (double)(colour.Red())/255.0; 00075 double g = (double)(colour.Green())/255.0; 00076 double b = (double)(colour.Blue())/255.0; 00077 00078 PlaneDirectionViewer::getInstance()->changeColor(this->_index,r,g,b); 00079 } 00080 delete colourdiag; 00081 00082 }
wxBitmapButton* PlaneDirectionViewerPanel::_colorchoose [private] |
Definition at line 21 of file PlaneDirectionViewerPanel.h.
Referenced by onColorChange(), and PlaneDirectionViewerPanel().
int PlaneDirectionViewerPanel::_index [private] |
Definition at line 18 of file PlaneDirectionViewerPanel.h.
Referenced by onCheckBoxChange(), onColorChange(), and PlaneDirectionViewerPanel().
wxCheckBox* PlaneDirectionViewerPanel::checkbox [private] |
Definition at line 19 of file PlaneDirectionViewerPanel.h.
Referenced by onCheckBoxChange(), and PlaneDirectionViewerPanel().