00001 #include "../../include/Grafico3d/Graph3DFrame.h"
00002
00003 IMPLEMENT_CLASS(Graph3DFrame,TBasePanel)
00005 BEGIN_EVENT_TABLE(Graph3DFrame,TBasePanel)
00007 EVT_SIZE(Graph3DFrame::OnSize)
00008 EVT_MENU(1026,Graph3DFrame::WxdeleteClick)
00009
00010 EVT_TEXT_ENTER(2001, Graph3DFrame::TxtYMaxEnter)
00011 EVT_TEXT_ENTER(2002, Graph3DFrame::TxtYMinEnter)
00012 EVT_TEXT_ENTER(2003, Graph3DFrame::TxtXMinEnter)
00013 EVT_TEXT_ENTER(2004, Graph3DFrame::TxtXMaxEnter)
00014 EVT_TEXT_ENTER(2005, Graph3DFrame::TxtZMinEnter)
00015 EVT_TEXT_ENTER(2006, Graph3DFrame::TxtZMaxEnter)
00016
00017
00019 END_EVENT_TABLE()
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 Graph3DFrame::Graph3DFrame(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name,gestione* gpannello) : TBasePanel(parent,id,pos,size,style,name,3)
00031 {
00032
00033 wxString value;
00034
00035 ImpostaUtilita(gpannello);
00036
00037 SetCursor(wxCURSOR_HAND);
00038
00039
00040
00041 ImpostaSelezione();
00042 Grafico=new WxGrafico(this,wxSize(GetSize().GetWidth()-80,GetSize().GetHeight()-60),NULL,-1,wxPoint(deltax_3D,deltay_3D),wxSIMPLE_BORDER);
00043
00044
00045 value.Printf(_T("%f"),Grafico->opzioni.ymax);
00046 TxtYMax=new wxTextCtrl(this,2001,value,wxPoint(20,30),wxSize(50,20),wxNO_BORDER);
00047 value.Printf(_T("%f"),Grafico->opzioni.ymin);
00048 TxtYMin=new wxTextCtrl(this,2002,value,wxPoint(20,this->GetSize().GetHeight()-50),wxSize(50,20),wxNO_BORDER);
00049 value.Printf(_T("%f"),Grafico->opzioni.xmin);
00050 TxtXMin=new wxTextCtrl(this,2003,value,wxPoint(70,this->GetSize().GetHeight()-30),wxSize(50,20),wxNO_BORDER);
00051 value.Printf(_T("%f"),Grafico->opzioni.xmax);
00052 TxtXMax=new wxTextCtrl(this,2004,value,wxPoint(this->GetSize().GetWidth()-60,this->GetSize().GetHeight()-30),wxSize(50,20),wxNO_BORDER);
00053 value.Printf(_T("%f"),Grafico->opzioni.zmin);
00054 TxtZMin=new wxTextCtrl(this,2005,value,wxPoint(70,10),wxSize(50,20),wxNO_BORDER);
00055 value.Printf(_T("%f"),Grafico->opzioni.zmax);
00056 TxtZMax=new wxTextCtrl(this,2006,value,wxPoint(this->GetSize().GetWidth()-60,10),wxSize(50,20),wxNO_BORDER);
00057
00058
00059
00060 }
00061
00062
00063
00064 void Graph3DFrame::OnSize(wxSizeEvent& event)
00065 {
00066
00067 Grafico->SetSize(wxSize(event.GetSize().GetWidth()-80,event.GetSize().GetHeight()-60));
00068 TxtYMin->Move(wxPoint(20,this->GetSize().GetHeight()-50));
00069 TxtXMin->Move(wxPoint(70,this->GetSize().GetHeight()-30));
00070 TxtXMax->Move(wxPoint(this->GetSize().GetWidth()-60,this->GetSize().GetHeight()-30));
00071 TxtZMax->Move(wxPoint(this->GetSize().GetWidth()-60,10));
00072
00073 }
00074
00075 int Graph3DFrame::GetMinWidth()
00076 {
00077 return 200;
00078 }
00079
00080 int Graph3DFrame::GetMinHeight()
00081 {
00082 return 220;
00083 }
00084
00085
00086 void Graph3DFrame::TxtYMaxEnter(wxCommandEvent& event)
00087 {
00088 if(Isnumeric(TxtYMax->GetValue().ToAscii()))
00089 { Grafico->opzioni.ymax=atof(TxtYMax->GetValue().ToAscii());
00090 CheckOptions();
00091 }
00092 else
00093 { wxString value;
00094 value.Printf(_T("%f"),Grafico->opzioni.ymax);
00095 TxtYMax->SetValue(value);
00096 }
00097 Grafico->SetFocus();
00098 }
00099
00100 void Graph3DFrame::TxtYMinEnter(wxCommandEvent& event)
00101 {
00102 if(Isnumeric(TxtYMin->GetValue().ToAscii()))
00103 { Grafico->opzioni.ymin=atof(TxtYMin->GetValue().ToAscii());
00104 CheckOptions();
00105 }
00106 else
00107 { wxString value;
00108 value.Printf(_T("%f"),Grafico->opzioni.ymin);
00109 TxtYMin->SetValue(value);
00110 }
00111
00112
00113 Grafico->SetFocus();
00114 }
00115
00116 void Graph3DFrame::TxtXMinEnter(wxCommandEvent& event)
00117 {
00118 if(Isnumeric(TxtXMin->GetValue().ToAscii()))
00119 { Grafico->opzioni.xmin=atof(TxtXMin->GetValue().ToAscii());
00120 CheckOptions();
00121 }
00122 else
00123 { wxString value;
00124 value.Printf(_T("%f"),Grafico->opzioni.xmin);
00125 TxtXMin->SetValue(value);
00126 }
00127 Grafico->SetFocus();
00128 }
00129
00130 void Graph3DFrame::TxtXMaxEnter(wxCommandEvent& event)
00131 {
00132 if(Isnumeric(TxtXMax->GetValue().ToAscii()))
00133 { Grafico->opzioni.xmax=atof(TxtXMax->GetValue().ToAscii());
00134 CheckOptions();
00135 }
00136 else
00137 { wxString value;
00138 value.Printf(_T("%f"),Grafico->opzioni.xmax);
00139 TxtXMax->SetValue(value);
00140 }
00141 CheckOptions();
00142 Grafico->SetFocus();
00143 }
00144
00145 void Graph3DFrame::TxtZMinEnter(wxCommandEvent& event)
00146 {
00147 if(Isnumeric(TxtZMin->GetValue().ToAscii()))
00148 { Grafico->opzioni.zmin=atof(TxtZMin->GetValue().ToAscii());
00149 CheckOptions();
00150 }
00151 else
00152 { wxString value;
00153 value.Printf(_T("%f"),Grafico->opzioni.zmin);
00154 TxtZMin->SetValue(value);
00155 }
00156 Grafico->SetFocus();
00157 }
00158
00159 void Graph3DFrame::TxtZMaxEnter(wxCommandEvent& event)
00160 {
00161 if(Isnumeric(TxtZMax->GetValue().ToAscii()))
00162 { Grafico->opzioni.zmax=atof(TxtZMax->GetValue().ToAscii());
00163 CheckOptions();
00164 }
00165 else
00166 { wxString value;
00167 value.Printf(_T("%f"),Grafico->opzioni.zmax);
00168 TxtZMax->SetValue(value);
00169 }
00170 CheckOptions();
00171 Grafico->SetFocus();
00172 }
00173
00174 void Graph3DFrame::CheckOptions()
00175 {
00176 bool errore=false;
00177
00178 if((Grafico->opzioni.xmin>=Grafico->opzioni.xmax))
00179 {errore=true;
00180 TxtXMin->SetForegroundColour(wxColour(0xff,0x0,0x0));
00181 TxtXMax->SetForegroundColour(wxColour(0xff,0x0,0x0));
00182 TxtXMin->SetToolTip(_T("Il limite inferiore deve essere minore di quello superiore"));
00183 TxtXMax->SetToolTip(_T("Il limite inferiore deve essere minore di quello superiore"));
00184 }
00185 else
00186 {TxtXMin->SetForegroundColour(wxColour(0x0,0x0,0x0));
00187 TxtXMax->SetForegroundColour(wxColour(0x0,0x0,0x0));
00188 TxtXMin->SetToolTip(_T(""));
00189 TxtXMax->SetToolTip(_T(""));
00190
00191 }
00192
00193 if((Grafico->opzioni.ymin>=Grafico->opzioni.ymax))
00194 {errore=true;
00195 TxtYMin->SetForegroundColour(wxColour(0xff,0x0,0x0));
00196 TxtYMax->SetForegroundColour(wxColour(0xff,0x0,0x0));
00197 TxtYMin->SetToolTip(_T("Il limite inferiore deve essere minore di quello superiore"));
00198 TxtYMax->SetToolTip(_T("Il limite inferiore deve essere minore di quello superiore"));
00199
00200 }
00201 else
00202 {TxtYMin->SetForegroundColour(wxColour(0x0,0x0,0x0));
00203 TxtYMax->SetForegroundColour(wxColour(0x0,0x0,0x0));
00204 TxtYMin->SetToolTip(_T(""));
00205 TxtYMax->SetToolTip(_T(""));
00206
00207
00208 }
00209
00210 if((Grafico->opzioni.zmin>=Grafico->opzioni.zmax))
00211 {errore=true;
00212 TxtZMin->SetForegroundColour(wxColour(0xff,0x0,0x0));
00213 TxtZMax->SetForegroundColour(wxColour(0xff,0x0,0x0));
00214 TxtZMin->SetToolTip(_T("Il limite inferiore deve essere minore di quello superiore"));
00215 TxtZMax->SetToolTip(_T("Il limite inferiore deve essere minore di quello superiore"));
00216
00217 }
00218 else
00219 {TxtZMin->SetForegroundColour(wxColour(0x0,0x0,0x0));
00220 TxtZMax->SetForegroundColour(wxColour(0x0,0x0,0x0));
00221 TxtZMin->SetToolTip(_T(""));
00222 TxtZMax->SetToolTip(_T(""));
00223
00224
00225 }
00226
00227
00228 if(errore)
00229 Grafico->Hide();
00230 else
00231 Grafico->Show();
00232
00233 this->Refresh();
00234 }
00235
00236
00237
00238
00239 void Graph3DFrame::WxdeleteClick(wxCommandEvent& event)
00240 {
00241
00242
00243
00244 event.Skip();
00245
00246 }
00247