00001 #ifndef _SOL_CALC_DIALOG_H_
00002 #define _SOL_CALC_DIALOG_H_
00003
00004 #include <wx/wx.h>
00005 #include <wx/defs.h>
00006 #include <wx/spinctrl.h>
00007 #include <string>
00008 #include <vector>
00009 #include "CutPlane.h"
00010
00011
00012 namespace FemViewer {
00013 class BBox3D;
00014
00015 namespace WxGUI {
00016
00018 class wxSolCalcDialog : public wxDialog
00019 {
00020 public:
00021
00022 wxSolCalcDialog(
00023 int & nreq,
00024 int & nr_sol,
00025 int & curr_sol,
00026 const std::string& formula
00027 );
00028
00029
00030
00031 int GetCurrSol(void){return _spinbutton->GetValue(); };
00032
00033
00034 void SetCurrSol(int val);
00035
00036
00037 std::string GetFunction(void);
00038
00039
00040 void SetFunction(const std::string &str);
00041
00042 private:
00043
00044
00045 int _nreq;
00046
00047 int _nr_sol;
00048
00049 int _curr_sol;
00050
00051 wxTextCtrl * _spintext;
00052 wxSpinButton * _spinbutton;
00053 wxTextCtrl * _textctrl;
00054
00055 wxString _txtStd;
00056 std::string _formula;
00057
00058 void OnSpinButtonUpdate( wxSpinEvent &event );
00059 void OnButtonTextReset( wxCommandEvent& event );
00060 void OnButtonTextFuncTest( wxCommandEvent& event );
00061
00062 void OnOk( wxCommandEvent& event );
00063 void OnHelp( wxCommandEvent& event );
00064
00065 enum
00066 {
00067 ID_SPIN = 1000,
00068 ID_TEXT_RESET,
00069 ID_TEXT_FUNC_TEST
00070 };
00071
00072 DECLARE_EVENT_TABLE()
00073
00074 inline void ClumpToRange(int val)
00075 {
00076 if(val < 0) _curr_sol = 0;
00077 else if(val > (_nr_sol - 1)) _curr_sol = _nr_sol -1;
00078 else _curr_sol = val;
00079 }
00080
00081 };
00082
00084 class wxPlaneCutDialog : public wxDialog
00085 {
00086 DECLARE_CLASS(wxPlaneCutDialog)
00087 DECLARE_EVENT_TABLE()
00088
00089 public:
00090
00091 wxPlaneCutDialog();
00092 wxPlaneCutDialog(wxWindow * parent, const BBox3D& bbox, std::vector<CutPlane>& ctpls,
00093 const bool use, const bool display);
00094 ~wxPlaneCutDialog();
00095
00096 void SetUseAll(bool use) { m_useAll = use; }
00097 bool GetUseAll() const { return m_useAll; }
00098
00099 void SetDisplayAll(bool display) { m_displayAll = display; }
00100 bool GetDisplayAll() const { return m_displayAll; }
00101
00102 void SetCutPlanes(const std::vector<CutPlane> planes) { m_planes = planes; }
00103 std::vector<CutPlane>& GetCutPlanes() { return m_planes; }
00104
00105
00106 protected:
00107
00108 enum {
00109 ID_USE_ALL = 100,
00110 ID_DISP_ALL,
00111 ID_NUM_PLANES,
00112 ID_USE_ITEM = 200,
00113 ID_DISP_ITEM = 300,
00114 };
00115
00116 static const int max_planes = 10;
00117 const BBox3D& m_bbox;
00118 bool m_useAll;
00119 bool m_displayAll;
00120 std::vector<CutPlane> m_planes;
00121 int m_numPls;
00122
00123 private:
00124
00125 wxSpinCtrl *m_scNumPlsl;
00126 wxCheckBox *m_cbUseAll, *m_cbDisplayAll;
00127 wxCheckBox *m_cbUseItem[max_planes];
00128 wxCheckBox *m_cbDisplayItem[max_planes];
00129 wxTextCtrl *m_tcParams[max_planes][4];
00130 wxFlexGridSizer *m_fgSizer;
00131 wxBoxSizer *m_topSizer;
00132
00133 private:
00134
00135
00136 void Init();
00137 void DoLayout();
00138 void OnUseAll(wxCommandEvent& evt);
00139 void OnDisplayAll(wxCommandEvent& evt);
00140 void OnNumPlanes(wxSpinEvent& evt);
00141 void OnOk( wxCommandEvent& event );
00142
00143 void HideRow(size_t index);
00144 void ShowRow(size_t index);
00145 void OnSize(wxSizeEvent& evt);
00146
00147
00148 };
00149
00150 }
00151 }
00152 #endif
00153
00154
00155