NIREP

ViewEvaluatorCommands.cpp

Go to the documentation of this file.
00001 
00002 // Name:        ViewEvaluatorCommands.cpp
00003 // Purpose:     
00004 // Author:      
00005 // Modified by: 
00006 // Created:     11/08/2010 11:03:14
00007 // RCS-ID:      
00008 // Copyright:   
00009 // Licence:     
00011 
00012 // For compilers that support precompilation, includes "wx/wx.h".
00013 #include "wx/wxprec.h"
00014 
00015 #ifdef __BORLANDC__
00016 #pragma hdrstop
00017 #endif
00018 
00019 #ifndef WX_PRECOMP
00020 #include "wx/wx.h"
00021 #endif
00022 
00025 
00026 #include "ViewEvaluatorCommands.h"
00027 #include "ViewWidgetCommands.h"
00028 #include "EzGrid.h"
00029 #include "GridCellChoiceRenderer.h"
00030 #include "FastComboEditor.h"
00031 #include "NIREPDefinitions.h"
00032 
00035 
00036 
00037 /*
00038  * ViewEvaluatorCommands type definition
00039  */
00040 
00041 IMPLEMENT_CLASS( ViewEvaluatorCommands, wxFrame )
00042 
00043 
00044 /*
00045  * ViewEvaluatorCommands event table definition
00046  */
00047 
00048 BEGIN_EVENT_TABLE( ViewEvaluatorCommands, wxFrame )
00049 
00051     EVT_BUTTON( ID_SHOW_DATA_INFO, ViewEvaluatorCommands::OnShowDataInfoClick )
00052 
00053     EVT_BUTTON( ID_SHOW_COORDINATE_SYSTEM, ViewEvaluatorCommands::OnShowCoordinateSystemClick )
00054 
00055     EVT_BUTTON( ID_ADD_COORDINATE, ViewEvaluatorCommands::OnAddCoordinateClick )
00056 
00057     EVT_BUTTON( ID_DELETE_COORDINATE, ViewEvaluatorCommands::OnDeleteCoordinateClick )
00058 
00059     EVT_BUTTON( ID_ADD_COMMAND, ViewEvaluatorCommands::OnAddCommandClick )
00060 
00061     EVT_BUTTON( ID_DELETE_COMMAND, ViewEvaluatorCommands::OnDeleteCommandClick )
00062 
00063     EVT_BUTTON( wxID_CANCEL, ViewEvaluatorCommands::OnCancelClick )
00064 
00065     EVT_BUTTON( ID_NEXT, ViewEvaluatorCommands::OnNextClick )
00066 
00067     EVT_GRID_CMD_CELL_CHANGE( ID_EVALUATOR_COMMAND_GRID, ViewEvaluatorCommands::OnEvaluatorGridCellChange )
00068 
00070 
00071 END_EVENT_TABLE()
00072 
00073 
00074 /*
00075  * ViewEvaluatorCommands constructors
00076  */
00077 
00078 ViewEvaluatorCommands::ViewEvaluatorCommands()
00079 {
00080     Init();
00081 }
00082 
00083 ViewEvaluatorCommands::ViewEvaluatorCommands( wxWindow* parent, bool quickView,  wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
00084 {
00085     Init();
00086     m_quickView = quickView;
00087     Create( parent, id, caption, pos, size, style );
00088 }
00089 
00090 
00091 /*
00092  * ViewEvaluatorCommands creator
00093  */
00094 
00095 bool ViewEvaluatorCommands::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
00096 {
00098     wxFrame::Create( parent, id, caption, pos, size, style );
00099 
00100     CreateControls();
00101     Centre();
00103     return true;
00104 }
00105 
00106 
00107 /*
00108  * ViewEvaluatorCommands destructor
00109  */
00110 
00111 ViewEvaluatorCommands::~ViewEvaluatorCommands()
00112 {
00115 }
00116 
00117 
00118 /*
00119  * Member initialisation
00120  */
00121 
00122 void ViewEvaluatorCommands::Init()
00123 {
00125     m_evaluatorList = NULL;
00126     m_evaluatorGrid = NULL;
00127     m_browseText = NULL;
00128     m_format = NULL;
00129     m_label = NULL;
00130     m_namespace = NULL;
00131     m_transformationUnits = NULL;
00132     m_nextVWC = NULL;
00133     m_quickView = false;
00134 
00135     m_transformationUnits = NULL;
00136     m_scrolledWindowCoordinateSystem = NULL;
00137 
00138     clickOne = false;
00139     clickTwo = false;
00141 }
00142 
00143 
00144 /*
00145  * Control creation for ViewEvaluatorCommands
00146  */
00147 
00148 void ViewEvaluatorCommands::CreateControls()
00149 {    
00151     ViewEvaluatorCommands* itemFrame1 = this;
00152 
00153     wxScrolledWindow* itemScrolledWindow2 = new wxScrolledWindow( itemFrame1, ID_SCROLLEDWINDOW4, wxDefaultPosition, wxSize(100, 100), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
00154     itemScrolledWindow2->SetScrollbars(1, 1, 0, 0);
00155     wxFlexGridSizer* itemFlexGridSizer3 = new wxFlexGridSizer(0, 1, 0, 0);
00156     itemFlexGridSizer3->AddGrowableRow(1);
00157     //itemFlexGridSizer3->AddGrowableRow(5);
00158     itemFlexGridSizer3->AddGrowableRow(7);
00159     itemFlexGridSizer3->AddGrowableCol(0);
00160     itemScrolledWindow2->SetSizer(itemFlexGridSizer3);
00161 
00162     wxStaticText* itemStaticText4 = new wxStaticText( itemScrolledWindow2, wxID_STATIC, _("Evaluator Commands"), wxDefaultPosition, wxDefaultSize, 0 );
00163     itemStaticText4->SetFont(wxFont(16, wxSWISS, wxNORMAL, wxNORMAL, false, wxT("Tahoma")));
00164     itemFlexGridSizer3->Add(itemStaticText4, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
00165 
00166     wxArrayString m_evaluatorListStrings;
00167     m_evaluatorList = new wxListBox( itemScrolledWindow2, ID_EVALUATOR_COMMAND_LIST, wxDefaultPosition, wxDefaultSize, m_evaluatorListStrings, wxLB_SINGLE );
00168     itemFlexGridSizer3->Add(m_evaluatorList, 0, wxGROW|wxGROW|wxALL, 5);
00169 
00170     m_evaluatorGrid = new EzGrid( itemScrolledWindow2, ID_EVALUATOR_COMMAND_GRID, wxDefaultPosition, wxSize(200, 110), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
00171     m_evaluatorGrid->SetDefaultColSize(150);
00172     m_evaluatorGrid->SetDefaultRowSize(50);
00173     m_evaluatorGrid->SetColLabelSize(25);
00174     m_evaluatorGrid->SetRowLabelSize(50);
00175     m_evaluatorGrid->CreateGrid(1, 3, wxGrid::wxGridSelectCells);
00176     itemFlexGridSizer3->Add(m_evaluatorGrid, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5);
00177 
00178     m_evaluatorGrid->SetColLabelValue(0,wxT("Evaluator ID"));
00179     m_evaluatorGrid->SetColLabelValue(1,wxT(""));
00180     m_evaluatorGrid->SetColLabelValue(2,wxT("Evaluator Command"));
00181     m_evaluatorGrid->SetColLabelValue(3,wxT("Input"));
00182 
00183     m_evaluatorGrid->SetCellRenderer(0, 2, new wxGridCellChoiceRenderer);
00184     wxString *strChoices = new wxString[EvalCmd.size()];
00185     int j=0;
00186     for(EvaluatorCmdList::iterator i = EvalCmd.begin(); i != EvalCmd.end(); i++, j++) {
00187       strChoices[j] = wxString(i->second.c_str(), wxConvUTF8);
00188     }
00189 //    m_evaluatorGrid->SetCellEditor(0, 2, new wxFastComboEditor(m_evaluatorGrid, wxID_ANY, j, strChoices, false));
00190     delete [] strChoices;
00191     m_evaluatorGrid->SetCellValue(wxT("="),0,1);
00192     m_evaluatorGrid->SetReadOnly(0,1);
00193     wxFlexGridSizer* itemFlexGridSizer7 = new wxFlexGridSizer(0, 2, 0, 0);
00194     itemFlexGridSizer7->AddGrowableCol(0);
00195     itemFlexGridSizer3->Add(itemFlexGridSizer7, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5);
00196     m_browseText = new wxTextCtrl( itemScrolledWindow2, ID_BROWSE_TEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
00197     itemFlexGridSizer7->Add(m_browseText, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5);
00198 
00199     m_browseText->SetValue(wxT("Choose a file or choose an evaluator command above"));
00200 
00201     wxButton* itemButton9 = new wxButton( itemScrolledWindow2, ID_BROWSE, wxT("Browse"), wxDefaultPosition, wxDefaultSize, 0 );
00202     itemFlexGridSizer7->Add(itemButton9, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
00203 
00204     wxButton* itemButton10 = new wxButton( itemScrolledWindow2, ID_SHOW_DATA_INFO, wxT("Show Data Information >>"), wxDefaultPosition, wxDefaultSize, 0 );
00205     itemFlexGridSizer3->Add(itemButton10, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
00206 
00207     wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxHORIZONTAL);
00208     itemFlexGridSizer3->Add(itemBoxSizer10, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
00209     wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
00210     itemBoxSizer10->Add(itemBoxSizer11, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00211     wxStaticText* itemStaticText12 = new wxStaticText( itemScrolledWindow2, ID_STATIC_FORMAT, _("Format"), wxDefaultPosition, wxDefaultSize, 0 );
00212     itemBoxSizer11->Add(itemStaticText12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00213     itemStaticText12->Show(false);
00214 
00215     wxArrayString m_formatStrings;
00216     m_format = new wxComboBox( itemScrolledWindow2, ID_COMBOBOX3, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_formatStrings, wxCB_DROPDOWN );
00217     itemBoxSizer11->Add(m_format, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00218     m_format->Show(false);
00219 
00220     wxBoxSizer* itemBoxSizer14 = new wxBoxSizer(wxVERTICAL);
00221     itemBoxSizer10->Add(itemBoxSizer14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00222     wxStaticText* itemStaticText15 = new wxStaticText( itemScrolledWindow2, ID_STATIC_LABEL, _("Label"), wxDefaultPosition, wxDefaultSize, 0 );
00223     itemBoxSizer14->Add(itemStaticText15, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00224     itemStaticText15->Show(false);
00225 
00226     m_label = new wxTextCtrl( itemScrolledWindow2, ID_TEXTCTRL11, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
00227     itemBoxSizer14->Add(m_label, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00228     m_label->Show(false);
00229 
00230     wxBoxSizer* itemBoxSizer17 = new wxBoxSizer(wxVERTICAL);
00231     itemBoxSizer10->Add(itemBoxSizer17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00232     wxStaticText* itemStaticText18 = new wxStaticText( itemScrolledWindow2, ID_STATIC_NAMESPACE, _("Namespace"), wxDefaultPosition, wxDefaultSize, 0 );
00233     itemBoxSizer17->Add(itemStaticText18, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00234     itemStaticText18->Show(false);
00235 
00236     m_namespace = new wxTextCtrl( itemScrolledWindow2, ID_TEXTCTRL13, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
00237     itemBoxSizer17->Add(m_namespace, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00238     m_namespace->Show(false);
00239 
00240     wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxVERTICAL);
00241     itemBoxSizer10->Add(itemBoxSizer20, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00242     wxStaticText* itemStaticText21 = new wxStaticText( itemScrolledWindow2, ID_STATIC_TRANSFORMATION_UNITS, _("Transformation units"), wxDefaultPosition, wxDefaultSize, 0 );
00243     itemBoxSizer20->Add(itemStaticText21, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00244     itemStaticText21->Show(false);
00245 
00246     wxArrayString m_transformationUnitsStrings;
00247     m_transformationUnits = new wxComboBox( itemScrolledWindow2, ID_COMBOBOX4, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_transformationUnitsStrings, wxCB_DROPDOWN );
00248     itemBoxSizer20->Add(m_transformationUnits, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00249     m_transformationUnits->Show(false);
00250 
00251     wxButton* itemButton25 = new wxButton( itemScrolledWindow2, ID_SHOW_COORDINATE_SYSTEM, _("Show Coordinate System >>"), wxDefaultPosition, wxDefaultSize, 0 );
00252     itemFlexGridSizer3->Add(itemButton25, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
00253 
00254     m_scrolledWindowCoordinateSystem = new wxScrolledWindow( itemScrolledWindow2, ID_SCROLLEDWINDOW3, wxDefaultPosition, wxSize(100,300), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
00255     m_scrolledWindowCoordinateSystem->Show(false);
00256     itemFlexGridSizer3->Add(m_scrolledWindowCoordinateSystem, 0, wxGROW|wxGROW|wxALL, 5);
00257     m_scrolledWindowCoordinateSystem->SetScrollbars(1, 1, 0, 0);
00258     wxBoxSizer* itemBoxSizer27 = new wxBoxSizer(wxHORIZONTAL);
00259     m_scrolledWindowCoordinateSystem->SetSizer(itemBoxSizer27);
00260 
00261     wxBoxSizer* itemBoxSizer28 = new wxBoxSizer(wxVERTICAL);
00262     itemBoxSizer27->Add(itemBoxSizer28, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00263     wxStaticText* itemStaticText29 = new wxStaticText( m_scrolledWindowCoordinateSystem, wxID_STATIC, _("coordinate 0 (source)"), wxDefaultPosition, wxDefaultSize, 0 );
00264     itemBoxSizer28->Add(itemStaticText29, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00265 
00266     wxTextCtrl* itemTextCtrl30 = new wxTextCtrl( m_scrolledWindowCoordinateSystem, ID_TEXTCTRL16, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
00267     itemBoxSizer28->Add(itemTextCtrl30, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00268 
00269     wxStaticText* itemStaticText31 = new wxStaticText( m_scrolledWindowCoordinateSystem, wxID_STATIC, _("namespace"), wxDefaultPosition, wxDefaultSize, 0 );
00270     itemBoxSizer28->Add(itemStaticText31, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00271 
00272     wxTextCtrl* itemTextCtrl32 = new wxTextCtrl( m_scrolledWindowCoordinateSystem, ID_TEXTCTRL17, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
00273     itemBoxSizer28->Add(itemTextCtrl32, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00274 
00275     wxStaticText* itemStaticText33 = new wxStaticText( m_scrolledWindowCoordinateSystem, wxID_STATIC, _("->"), wxDefaultPosition, wxDefaultSize, 0 );
00276     itemStaticText33->SetForegroundColour(wxColour(255, 0, 0));
00277     itemStaticText33->SetFont(wxFont(16, wxSWISS, wxNORMAL, wxNORMAL, false, wxT("Tahoma")));
00278     itemBoxSizer27->Add(itemStaticText33, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00279 
00280     wxBoxSizer* itemBoxSizer34 = new wxBoxSizer(wxVERTICAL);
00281     itemBoxSizer27->Add(itemBoxSizer34, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00282     wxStaticText* itemStaticText35 = new wxStaticText( m_scrolledWindowCoordinateSystem, wxID_STATIC, _("Algorithm Name"), wxDefaultPosition, wxDefaultSize, 0 );
00283     itemBoxSizer34->Add(itemStaticText35, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00284 
00285     wxTextCtrl* itemTextCtrl36 = new wxTextCtrl( m_scrolledWindowCoordinateSystem, ID_TEXTCTRL18, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
00286     itemBoxSizer34->Add(itemTextCtrl36, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00287 
00288     wxStaticText* itemStaticText37 = new wxStaticText( m_scrolledWindowCoordinateSystem, wxID_STATIC, _("->"), wxDefaultPosition, wxDefaultSize, 0 );
00289     itemStaticText37->SetForegroundColour(wxColour(255, 0, 0));
00290     itemStaticText37->SetFont(wxFont(16, wxSWISS, wxNORMAL, wxNORMAL, false, wxT("Tahoma")));
00291     itemBoxSizer27->Add(itemStaticText37, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00292 
00293     wxBoxSizer* itemBoxSizer38 = new wxBoxSizer(wxVERTICAL);
00294     itemBoxSizer27->Add(itemBoxSizer38, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00295     wxStaticText* itemStaticText39 = new wxStaticText( m_scrolledWindowCoordinateSystem, wxID_STATIC, _("coordinate 1 (target)"), wxDefaultPosition, wxDefaultSize, 0 );
00296     itemBoxSizer38->Add(itemStaticText39, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00297 
00298     wxTextCtrl* itemTextCtrl40 = new wxTextCtrl( m_scrolledWindowCoordinateSystem, ID_TEXTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
00299     itemBoxSizer38->Add(itemTextCtrl40, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00300 
00301     wxStaticText* itemStaticText41 = new wxStaticText( m_scrolledWindowCoordinateSystem, wxID_STATIC, _("namespace"), wxDefaultPosition, wxDefaultSize, 0 );
00302     itemBoxSizer38->Add(itemStaticText41, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00303 
00304     wxTextCtrl* itemTextCtrl42 = new wxTextCtrl( m_scrolledWindowCoordinateSystem, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
00305     itemBoxSizer38->Add(itemTextCtrl42, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00306 
00307     m_scrolledWindowCoordinateSystem->FitInside();
00308 
00309     m_scrolledWindowCoordinateSystem->SetMinSize(wxSize(-1, 300) );
00310     wxBoxSizer* itemBoxSizer43 = new wxBoxSizer(wxHORIZONTAL);
00311     itemFlexGridSizer3->Add(itemBoxSizer43, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
00312     wxButton* itemButton44 = new wxButton( itemScrolledWindow2, ID_ADD_COORDINATE, _("Add Coordinate System"), wxDefaultPosition, wxDefaultSize, 0 );
00313     itemBoxSizer43->Add(itemButton44, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00314     itemButton44->Show(false);
00315 
00316     wxButton* itemButton45 = new wxButton( itemScrolledWindow2, ID_DELETE_COORDINATE, _("Delete Coordinate System"), wxDefaultPosition, wxDefaultSize, 0 );
00317     itemBoxSizer43->Add(itemButton45, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00318     itemButton45->Show(false);
00319 
00320     wxBoxSizer* itemBoxSizer46 = new wxBoxSizer(wxHORIZONTAL);
00321     itemFlexGridSizer3->Add(itemBoxSizer46, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
00322     wxButton* itemButton47 = new wxButton( itemScrolledWindow2, ID_ADD_COMMAND, _("Add Command"), wxDefaultPosition, wxDefaultSize, 0 );
00323     itemBoxSizer46->Add(itemButton47, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00324 
00325     wxButton* itemButton48 = new wxButton( itemScrolledWindow2, ID_DELETE_COMMAND, _("Delete Command"), wxDefaultPosition, wxDefaultSize, 0 );
00326     itemBoxSizer46->Add(itemButton48, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00327 
00328 
00329     if(m_quickView) {
00330       wxBoxSizer* itemBoxSizer49 = new wxBoxSizer(wxHORIZONTAL);
00331       itemFlexGridSizer3->Add(itemBoxSizer49, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
00332       wxButton* itemButton50 = new wxButton( itemScrolledWindow2, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
00333       itemBoxSizer49->Add(itemButton50, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00334 
00335       wxButton* itemButton51 = new wxButton( itemScrolledWindow2, ID_NEXT, _("Next"), wxDefaultPosition, wxDefaultSize, 0 );
00336       itemBoxSizer49->Add(itemButton51, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00337     }
00338 
00339     itemScrolledWindow2->FitInside();
00340 
00342 }
00343 
00344 
00345 /*
00346  * Should we show tooltips?
00347  */
00348 
00349 bool ViewEvaluatorCommands::ShowToolTips()
00350 {
00351     return true;
00352 }
00353 
00354 /*
00355  * Get bitmap resources
00356  */
00357 
00358 wxBitmap ViewEvaluatorCommands::GetBitmapResource( const wxString& name )
00359 {
00360     // Bitmap retrieval
00362     wxUnusedVar(name);
00363     return wxNullBitmap;
00365 }
00366 
00367 /*
00368  * Get icon resources
00369  */
00370 
00371 wxIcon ViewEvaluatorCommands::GetIconResource( const wxString& name )
00372 {
00373     // Icon retrieval
00375     wxUnusedVar(name);
00376     return wxNullIcon;
00378 }
00379 
00380 
00381 /*
00382  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SHOW_COORDINATE_SYSTEM
00383  */
00384 
00385 void ViewEvaluatorCommands::OnShowDataInfoClick( wxCommandEvent& event )
00386 {
00387   this->FindWindow(ID_STATIC_FORMAT)->Show(!clickOne);
00388   this->FindWindow(ID_STATIC_LABEL)->Show(!clickOne);
00389   this->FindWindow(ID_STATIC_NAMESPACE)->Show(!clickOne);
00390   this->FindWindow(ID_STATIC_TRANSFORMATION_UNITS)->Show(!clickOne);
00391 
00392   this->FindWindow(ID_COMBOBOX3)->Show(!clickOne);
00393   this->FindWindow(ID_TEXTCTRL11)->Show(!clickOne);
00394   this->FindWindow(ID_TEXTCTRL13)->Show(!clickOne);
00395   this->FindWindow(ID_COMBOBOX4)->Show(!clickOne);
00396   clickOne = !clickOne;
00397 
00398   if(clickOne) {
00399     dynamic_cast<wxButton*>(this->FindWindow(ID_SHOW_DATA_INFO))->SetLabel(wxT( "<< Hide Data Information" ));
00400   }
00401   else {
00402     dynamic_cast<wxButton*>(this->FindWindow(ID_SHOW_DATA_INFO))->SetLabel(wxT("Show Data Information >>"));
00403   }
00404   
00405   
00406   //this->FindWindow(ID_SCROLLEDWINDOW6)->Refresh();
00407   //this->FindWindow(ID_SCROLLEDWINDOW6)->Update();
00408   //this->FindWindow(ID_SCROLLEDWINDOW4)->Refresh();
00409   this->FindWindow(ID_SCROLLEDWINDOW4)->GetSizer()->Layout();
00410 }
00411 
00412 
00413 /*
00414  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SHOW_DATA_INFO
00415  */
00416 
00417 void ViewEvaluatorCommands::OnShowCoordinateSystemClick( wxCommandEvent& event )
00418 {
00419   m_scrolledWindowCoordinateSystem->Show(!clickTwo);
00420   this->FindWindow(ID_ADD_COORDINATE)->Show(!clickTwo);
00421   this->FindWindow(ID_DELETE_COORDINATE)->Show(!clickTwo);
00422   clickTwo = !clickTwo;
00423 
00424   if(clickTwo) {
00425     dynamic_cast<wxButton*>(this->FindWindow(ID_SHOW_COORDINATE_SYSTEM))->SetLabel(wxT("<< Hide Coordinate System"));
00426   }
00427   else {
00428     dynamic_cast<wxButton*>(this->FindWindow(ID_SHOW_COORDINATE_SYSTEM))->SetLabel(wxT("Show Coordinate System >>"));
00429   }
00430   
00431   //this->FindWindow(ID_SCROLLEDWINDOW3)->Refresh();
00432   //this->FindWindow(ID_SCROLLEDWINDOW3)->Update();
00433   //this->FindWindow(ID_SCROLLEDWINDOW4)->Refresh();
00434 
00435   this->FindWindow(ID_SCROLLEDWINDOW4)->GetSizer()->Layout();
00436 }
00437 
00438 
00439 /*
00440  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ADD_COORDINATE
00441  */
00442 
00443 void ViewEvaluatorCommands::OnAddCoordinateClick( wxCommandEvent& event )
00444 {
00446     // Before editing this code, remove the block markers.
00447     event.Skip();
00449 }
00450 
00451 
00452 /*
00453  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_COORDINATE
00454  */
00455 
00456 void ViewEvaluatorCommands::OnDeleteCoordinateClick( wxCommandEvent& event )
00457 {
00459     // Before editing this code, remove the block markers.
00460     event.Skip();
00462 }
00463 
00464 
00465 /*
00466  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ADD_COMMAND
00467  */
00468 
00469 void ViewEvaluatorCommands::OnAddCommandClick( wxCommandEvent& event )
00470 {
00472     // Before editing this code, remove the block markers.
00473     event.Skip();
00475 }
00476 
00477 
00478 /*
00479  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_COMMAND
00480  */
00481 
00482 void ViewEvaluatorCommands::OnDeleteCommandClick( wxCommandEvent& event )
00483 {
00485     // Before editing this code, remove the block markers.
00486     event.Skip();
00488 }
00489 
00490 
00491 /*
00492  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_NEXT
00493  */
00494 
00495 void ViewEvaluatorCommands::OnNextClick( wxCommandEvent& event )
00496 {
00497   this->Show(false);
00498   if( m_nextVWC == NULL ) {
00499     m_nextVWC = new ViewWidgetCommands(this,this);
00500   }
00501   m_nextVWC->Show();
00502 }
00503 
00504 
00505 /*
00506  * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
00507  */
00508 
00509 void ViewEvaluatorCommands::OnCancelClick( wxCommandEvent& event )
00510 {
00511   if(m_nextVWC != NULL) {
00512     m_nextVWC->Close();
00513   }
00514   this->Close();
00515 }
00516 
00517 /*
00518  * wxEVT_GRID_CMD_CELL_CHANGE event handler for ID_EVALUATOR_GRID
00519  */
00520 
00521 void ViewEvaluatorCommands::OnEvaluatorGridCellChange( wxGridEvent& event )
00522 {
00523   int col = event.GetCol();
00524   if(event.GetRow() == 0 && col == 2) {
00525     if( EvalCmd.find("SpatialData")->second.compare(std::string( m_evaluatorGrid->GetCellValue(0,2).mb_str() ) ) == 0 ||
00526         EvalCmd.find("Transformation")->second.compare(std::string(m_evaluatorGrid->GetCellValue(0,2).mb_str()) ) == 0) {
00527       m_browseText->Show(true);
00528       m_browseText->SetValue(wxT("Choose file(s)"));
00529       this->FindWindow(ID_BROWSE)->Show(true);
00530       this->FindWindow(ID_SHOW_COORDINATE_SYSTEM)->Show(true);
00531       this->FindWindow(ID_SHOW_DATA_INFO)->Show(true);
00532     } else {
00533       m_browseText->Show(false);
00534       this->FindWindow(ID_BROWSE)->Show(false);
00535       this->FindWindow(ID_SHOW_COORDINATE_SYSTEM)->Show(false);
00536       this->FindWindow(ID_SHOW_DATA_INFO)->Show(false);
00537 
00538       m_scrolledWindowCoordinateSystem->Show(false);
00539       this->FindWindow(ID_ADD_COORDINATE)->Show(false);
00540       this->FindWindow(ID_DELETE_COORDINATE)->Show(false);
00541 
00542       this->FindWindow(ID_STATIC_FORMAT)->Show(false);
00543       this->FindWindow(ID_STATIC_LABEL)->Show(false);
00544       this->FindWindow(ID_STATIC_NAMESPACE)->Show(false);
00545       this->FindWindow(ID_STATIC_TRANSFORMATION_UNITS)->Show(false);
00546 
00547       this->FindWindow(ID_COMBOBOX3)->Show(false);
00548       this->FindWindow(ID_TEXTCTRL11)->Show(false);
00549       this->FindWindow(ID_TEXTCTRL13)->Show(false);
00550       this->FindWindow(ID_COMBOBOX4)->Show(false);
00551     }
00552     std::pair<EvaluatorInputList::iterator,EvaluatorInputList::iterator> ret = EvalInput.equal_range( std::string(m_evaluatorGrid->GetCellValue(0,2).mb_str()) );
00553     col++;
00554     for(EvaluatorInputList::iterator i = ret.first; i != ret.second; i++,col++) {
00555       if(col > m_evaluatorGrid->GetNumberCols()-1 ) {
00556         m_evaluatorGrid->AppendCols();
00557         m_evaluatorGrid->SetCellRenderer(0, col, new wxGridCellChoiceRenderer);
00558 //        m_evaluatorGrid->SetCellEditor(0, col, new wxFastComboEditor());
00559       }
00560       m_evaluatorGrid->SetColLabelValue(col,wxString(i->second.c_str(), wxConvUTF8));
00561       wxString strChoices;
00562       int j=0;
00563       for(EvaluatorCmdList::iterator i = EvalCmd.begin(); i != EvalCmd.end(); i++, j++) {
00564         strChoices.Append(wxString(i->second.c_str(), wxConvUTF8));
00565         strChoices.Append(wxT(","));
00566       }
00567       strChoices.Remove(strChoices.size()-1);
00568       m_evaluatorGrid->GetCellEditor(0, col)->SetParameters(strChoices);
00569     }
00570 
00571     if(m_evaluatorGrid->GetNumberCols() > (col) ) {
00572       for(int i = m_evaluatorGrid->GetNumberCols(); i > (col); i--) {
00573         m_evaluatorGrid->DeleteCols(i-1);
00574       }
00575     }
00576   }
00577 }
00578 
00579 
00580 /*
00581  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BROWSE
00582  */
00583 
00584 void ViewEvaluatorCommands::OnBrowseClick( wxCommandEvent& event )
00585 {
00586   wxFileDialog * filedialog = new wxFileDialog(this, wxT("Choose a file(s) to use for data.  If multiple files then please choose 3 that correspond to one data."), wxT(""), wxT("*"), wxT("*"),  wxFD_OPEN|wxFD_FILE_MUST_EXIST|wxFD_MULTIPLE, wxDefaultPosition, wxDefaultSize, wxT("Open"));
00587   if( filedialog->ShowModal() == wxID_CANCEL ){ delete filedialog; return;}
00588 
00589   wxArrayString tempTwo;
00590   filedialog->GetPaths(tempTwo);
00591   wxString tempThree;
00592   int count = 0;
00593   for(wxArrayString::iterator i = tempTwo.begin(); i != tempTwo.end(); i++) {
00594     tempThree.Append(i->c_str());
00595     tempThree.Append(wxT(";"));
00596     count++;
00597   }
00598   wxString::iterator semiColonErase = tempThree.end();
00599   semiColonErase--;
00600   tempThree.erase(semiColonErase,tempThree.end());
00601   m_browseText->SetValue(tempThree );
00602 
00603   
00604   size_t dot = filedialog->GetFilename().find_last_of(wxT("."));
00605   std::string extension(std::string(filedialog->GetFilename().mb_str()),dot);
00606 
00607   if(count == 3) {
00608     //we have a disp transformation
00609   }
00610 //  else if(extension.compare()) {
00611  // }
00612 
00613   delete filedialog;
00614 
00615 }
00616 
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines