creaContours_lib
PanelBullEyeOptions Class Reference

#include <PanelBullEyeOptions.h>

Inheritance diagram for PanelBullEyeOptions:
Collaboration diagram for PanelBullEyeOptions:

Public Member Functions

 PanelBullEyeOptions (wxWindow *parent, wxSize size)
 
 ~PanelBullEyeOptions ()
 
void onRefreshPanel (wxCommandEvent &event)
 
int GetNumberOfCrowns ()
 
int GetNumberOfSections (int nCrown)
 
int GetRadioOfCrown (int nCrown)
 
double GetAngOfCrownSection (int nCrown, int section)
 
double GetAngDeltaOfCrownSection (int nCrown)
 

Private Member Functions

void RefreshPanel ()
 

Private Attributes

int _maxLevels
 
int _maxSections
 
wxRadioBox * _radioboxBullEyeGenOpt
 
wxSpinCtrl * _spinctrlBullEyeNumOfCrowns
 
wxSpinCtrl * _spinctrlBullEyeNumOfSec
 
wxSlider * _sliderBullEyeAngle
 
std::vector< wxSpinCtrl * > _lstBullEyeDetailNumOfSec
 
std::vector< wxSlider * > _lstBullEyeDetailRadio
 
std::vector< wxSlider * > _lstBullEyeDetailAngle
 

Detailed Description

Definition at line 54 of file PanelBullEyeOptions.h.

Constructor & Destructor Documentation

PanelBullEyeOptions::PanelBullEyeOptions ( wxWindow *  parent,
wxSize  size 
)

Definition at line 37 of file PanelBullEyeOptions.cxx.

References _lstBullEyeDetailAngle, _lstBullEyeDetailNumOfSec, _lstBullEyeDetailRadio, _maxLevels, _maxSections, _radioboxBullEyeGenOpt, _sliderBullEyeAngle, _spinctrlBullEyeNumOfCrowns, _spinctrlBullEyeNumOfSec, onRefreshPanel(), and RefreshPanel().

38  :
39  wxPanel(parent, -1, wxDefaultPosition, size)
40 {
41 
42  _maxLevels = 5;
43  _maxSections = 10;
44  wxSize sizepanel(190,300);
45  wxPanel *panel = this;
46 
47 
48  wxString lstOptions[2];
49  lstOptions[0]= wxString("General options",wxConvUTF8);
50  lstOptions[1]= wxString("Detail options",wxConvUTF8);
51  _radioboxBullEyeGenOpt = new wxRadioBox(panel, -1, wxString("General/Detail options",wxConvUTF8), wxDefaultPosition, wxSize(200,45), 2 , lstOptions, 2, wxRA_SPECIFY_COLS);
52  _radioboxBullEyeGenOpt->SetSelection(0);
53 
54  _spinctrlBullEyeNumOfCrowns = new wxSpinCtrl( panel , -1,_T("B"),wxDefaultPosition, wxSize(40,20) );
56  _spinctrlBullEyeNumOfCrowns->SetValue(3);
57 
58  _spinctrlBullEyeNumOfSec = new wxSpinCtrl( panel , -1,_T("A"),wxDefaultPosition, wxSize(40,20) );
60  _spinctrlBullEyeNumOfSec->SetValue(5);
61 
62 
63  _sliderBullEyeAngle = new wxSlider( panel , -1 ,0,0,180, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
64 
65  wxFlexGridSizer * sizerGeneralOptions = new wxFlexGridSizer(10);
66 
67  wxFlexGridSizer * sizerGeneralOptionsA = new wxFlexGridSizer(1);
68  wxFlexGridSizer * sizerGeneralOptionsB = new wxFlexGridSizer(1);
69  wxFlexGridSizer * sizerGeneralOptionsC = new wxFlexGridSizer(1);
70  sizerGeneralOptionsA -> Add( new wxStaticText(panel,-1,_T("Crowns")) , 1, wxGROW );
71  sizerGeneralOptionsA -> Add( _spinctrlBullEyeNumOfCrowns , 1/*, wxGROW*/ );
72  sizerGeneralOptionsB -> Add( new wxStaticText(panel,-1,_T("Sections")) , 1, wxGROW );
73  sizerGeneralOptionsB -> Add( _spinctrlBullEyeNumOfSec , 1/*, wxGROW*/ );
74  sizerGeneralOptionsC -> Add( new wxStaticText(panel,-1,_T(" Angle")) , 1, wxGROW );
75  sizerGeneralOptionsC -> Add( _sliderBullEyeAngle , 1/*, wxGROW*/ );
76 
77  sizerGeneralOptions -> Add( sizerGeneralOptionsA , 1/*, wxGROW*/ );
78  sizerGeneralOptions -> Add( new wxStaticText(panel,-1,_T(" ")) , 1, wxGROW );
79  sizerGeneralOptions -> Add( sizerGeneralOptionsB , 1/*, wxGROW*/ );
80  sizerGeneralOptions -> Add( new wxStaticText(panel,-1,_T(" ")) , 1, wxGROW );
81  sizerGeneralOptions -> Add( sizerGeneralOptionsC , 1/*, wxGROW*/ );
82 
83 
84  wxSpinCtrl *tmpSpinSection;
85  wxSlider *tmpSliderRadio;
86  wxSlider *tmpSliderAng;
87 
88  wxFlexGridSizer * sizerDetailOptions = new wxFlexGridSizer(6);
89 
90  sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("Crown ")) , 1, wxGROW );
91  sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T(" Sections ")) , 1, wxGROW );
92  sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T(" ")) , 1, wxGROW );
93  sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T(" Radio %")) , 1, wxGROW );
94  sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T(" ")) , 1, wxGROW );
95  sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T(" Angle")) , 1, wxGROW );
96 
97  wxString tmpwxstring;
98  int i;
99  for (i=0;i<_maxLevels;i++){
100  tmpSpinSection = new wxSpinCtrl( panel , -1,_T(""),wxDefaultPosition, wxSize(40,20) );
101  tmpSliderRadio = new wxSlider( panel , -1 ,0,0,100, wxDefaultPosition, wxSize(110,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
102  tmpSliderAng = new wxSlider( panel , -1 ,0,0,180, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
103 
104  tmpSpinSection ->SetRange(1,_maxSections);
105 
106  tmpwxstring.Printf(_T(" %d. "),i+1);
107  sizerDetailOptions -> Add( new wxStaticText(panel,-1,tmpwxstring) , 1, wxGROW );
108  sizerDetailOptions -> Add( tmpSpinSection, 1 );
109  sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T(" ")) , 1, wxGROW );
110  sizerDetailOptions -> Add( tmpSliderRadio, 1, wxGROW );
111  sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T(" ")) , 1, wxGROW );
112  sizerDetailOptions -> Add( tmpSliderAng, 1, wxGROW );
113 
114  tmpSpinSection -> SetValue(5);
115  tmpSliderRadio -> SetValue( 100-(double)((i)*100.0/_maxLevels) );
116  tmpSliderAng -> SetValue(0);
117 
118  Connect( tmpSliderRadio->GetId(), wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel );
119  Connect( tmpSliderRadio->GetId(), wxEVT_SCROLL_CHANGED , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel );
120 
121  _lstBullEyeDetailNumOfSec.push_back( tmpSpinSection );
122  _lstBullEyeDetailRadio.push_back( tmpSliderRadio );
123  _lstBullEyeDetailAngle.push_back( tmpSliderAng );
124 
125  } //for
126 
127  wxFlexGridSizer * sizer = new wxFlexGridSizer(1);
128  sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
129  sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
130  sizer -> Add( _radioboxBullEyeGenOpt , 1, wxGROW );
131  sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
132  sizer -> Add( new wxStaticText(panel,-1,_T(" -- Bull Eye general options --")) , 1, wxGROW );
133  sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
134  sizer -> Add( sizerGeneralOptions , 1, wxGROW );
135  sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
136  sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
137  sizer -> Add( new wxStaticText(panel,-1,_T(" -- Bull Eye detail options --")) , 1, wxGROW );
138  sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
139  sizer -> Add( sizerDetailOptions , 1, wxGROW );
140 
141  Connect( _radioboxBullEyeGenOpt->GetId(), wxEVT_COMMAND_RADIOBOX_SELECTED , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel );
142  Connect( _spinctrlBullEyeNumOfCrowns->GetId(), wxEVT_COMMAND_TEXT_UPDATED , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel );
143 
144  panel->SetSizer( sizer );
145  panel->SetSize( sizepanel );
146  panel->SetAutoLayout( true );
147  panel->Layout();
148 
149  RefreshPanel();
150 
}

Here is the call graph for this function:

PanelBullEyeOptions::~PanelBullEyeOptions ( )

Definition at line 153 of file PanelBullEyeOptions.cxx.

154 {
155 }

Member Function Documentation

double PanelBullEyeOptions::GetAngDeltaOfCrownSection ( int  nCrown)

Definition at line 244 of file PanelBullEyeOptions.cxx.

References GetNumberOfSections().

Referenced by GetAngOfCrownSection().

245 {
246  double numOfSec = (double)GetNumberOfSections(nCrown);
247  return 360.0/numOfSec;
248 }

Here is the call graph for this function:

Here is the caller graph for this function:

double PanelBullEyeOptions::GetAngOfCrownSection ( int  nCrown,
int  section 
)

Definition at line 229 of file PanelBullEyeOptions.cxx.

References _lstBullEyeDetailAngle, _radioboxBullEyeGenOpt, _sliderBullEyeAngle, and GetAngDeltaOfCrownSection().

230 {
231  double angle;
232  if (this->_radioboxBullEyeGenOpt->GetSelection()==0)
233  {
234  angle = this->_sliderBullEyeAngle->GetValue();
235  } else {
236  angle = this->_lstBullEyeDetailAngle[nCrown]->GetValue();
237  }
238 // double numOfSec = (double)GetNumberOfSections(nCrown);
239  double deltaSec = GetAngDeltaOfCrownSection(nCrown);
240  return angle + section*deltaSec ;
241 }

Here is the call graph for this function:

int PanelBullEyeOptions::GetNumberOfCrowns ( )

Definition at line 195 of file PanelBullEyeOptions.cxx.

References _spinctrlBullEyeNumOfCrowns.

196 {
197  return this->_spinctrlBullEyeNumOfCrowns->GetValue();
198 }
int PanelBullEyeOptions::GetNumberOfSections ( int  nCrown)

Definition at line 201 of file PanelBullEyeOptions.cxx.

References _lstBullEyeDetailNumOfSec, _radioboxBullEyeGenOpt, and _spinctrlBullEyeNumOfSec.

Referenced by GetAngDeltaOfCrownSection().

202 {
203  int result;
204  if (this->_radioboxBullEyeGenOpt->GetSelection()==0)
205  {
206  result = this->_spinctrlBullEyeNumOfSec->GetValue();
207  } else {
208  result = this->_lstBullEyeDetailNumOfSec[nCrown]->GetValue();
209  }
210  return result;
211 }

Here is the caller graph for this function:

int PanelBullEyeOptions::GetRadioOfCrown ( int  nCrown)

Definition at line 214 of file PanelBullEyeOptions.cxx.

References _lstBullEyeDetailRadio, _radioboxBullEyeGenOpt, and _spinctrlBullEyeNumOfCrowns.

215 {
216  int result;
217  double sizeCrowns;
218  if (this->_radioboxBullEyeGenOpt->GetSelection()==0)
219  {
220  sizeCrowns = (double)( this->_spinctrlBullEyeNumOfCrowns->GetValue() );
221  result = 100.0 * (nCrown+1)/sizeCrowns ;
222  } else {
223  result = this->_lstBullEyeDetailRadio[nCrown]->GetValue();
224  }
225  return result;
226 }
void PanelBullEyeOptions::onRefreshPanel ( wxCommandEvent &  event)

Definition at line 158 of file PanelBullEyeOptions.cxx.

References RefreshPanel().

Referenced by PanelBullEyeOptions().

159 {
160  RefreshPanel();
161 }

Here is the call graph for this function:

Here is the caller graph for this function:

void PanelBullEyeOptions::RefreshPanel ( )
private

Definition at line 164 of file PanelBullEyeOptions.cxx.

References _lstBullEyeDetailAngle, _lstBullEyeDetailNumOfSec, _lstBullEyeDetailRadio, _maxLevels, _radioboxBullEyeGenOpt, and _spinctrlBullEyeNumOfCrowns.

Referenced by onRefreshPanel(), and PanelBullEyeOptions().

165 {
166  int i;
167  bool ok;
168  if (this->_radioboxBullEyeGenOpt->GetSelection()==0){
169  for (i=0; i<_maxLevels; i++)
170  {
171  _lstBullEyeDetailNumOfSec[i] -> Enable(false);
172  _lstBullEyeDetailRadio[i] -> Enable(false);
173  _lstBullEyeDetailAngle[i] -> Enable(false);
174  } // for
175  } else {
176  int spinSelec = _spinctrlBullEyeNumOfCrowns->GetValue();
177  for (i=0; i<_maxLevels; i++)
178  {
179  ok = (i < spinSelec);
180  _lstBullEyeDetailNumOfSec[i] -> Enable(ok);
181  _lstBullEyeDetailRadio[i] -> Enable(ok);
182  _lstBullEyeDetailAngle[i] -> Enable(ok);
183 
184  if (i>0){
185  if (_lstBullEyeDetailRadio[i]->GetValue() > _lstBullEyeDetailRadio[i-1]->GetValue())
186  {
187  _lstBullEyeDetailRadio[i]->SetValue( _lstBullEyeDetailRadio[i-1]->GetValue() );
188  }
189  }// if i>0
190  } // for
191  } // if
192 }

Here is the caller graph for this function:

Member Data Documentation

std::vector<wxSlider *> PanelBullEyeOptions::_lstBullEyeDetailAngle
private

Definition at line 75 of file PanelBullEyeOptions.h.

Referenced by GetAngOfCrownSection(), PanelBullEyeOptions(), and RefreshPanel().

std::vector<wxSpinCtrl *> PanelBullEyeOptions::_lstBullEyeDetailNumOfSec
private

Definition at line 73 of file PanelBullEyeOptions.h.

Referenced by GetNumberOfSections(), PanelBullEyeOptions(), and RefreshPanel().

std::vector<wxSlider *> PanelBullEyeOptions::_lstBullEyeDetailRadio
private

Definition at line 74 of file PanelBullEyeOptions.h.

Referenced by GetRadioOfCrown(), PanelBullEyeOptions(), and RefreshPanel().

int PanelBullEyeOptions::_maxLevels
private

Definition at line 67 of file PanelBullEyeOptions.h.

Referenced by PanelBullEyeOptions(), and RefreshPanel().

int PanelBullEyeOptions::_maxSections
private

Definition at line 68 of file PanelBullEyeOptions.h.

Referenced by PanelBullEyeOptions().

wxRadioBox* PanelBullEyeOptions::_radioboxBullEyeGenOpt
private
wxSlider* PanelBullEyeOptions::_sliderBullEyeAngle
private

Definition at line 72 of file PanelBullEyeOptions.h.

Referenced by GetAngOfCrownSection(), and PanelBullEyeOptions().

wxSpinCtrl* PanelBullEyeOptions::_spinctrlBullEyeNumOfCrowns
private
wxSpinCtrl* PanelBullEyeOptions::_spinctrlBullEyeNumOfSec
private

Definition at line 71 of file PanelBullEyeOptions.h.

Referenced by GetNumberOfSections(), and PanelBullEyeOptions().


The documentation for this class was generated from the following files: