NIREP
|
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 // 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 // 00023 //#include "wx/imaglist.h" 00024 // 00025 #include "GenerateRDL.h" 00026 #include "NIREPDefinitions.h" 00027 #include "ViewRDL.h" 00028 // 00029 // 00030 // 00031 // 00032 // 00033 // 00035 // * GenerateRDL type definition 00036 // */ 00037 // 00038 IMPLEMENT_CLASS( GenerateRDL, wxFrame ) 00039 // 00040 // 00042 // * GenerateRDL event table definition 00043 // */ 00044 // 00045 BEGIN_EVENT_TABLE( GenerateRDL, wxFrame ) 00046 00047 EVT_COMBOBOX( ID_DATATYPE, GenerateRDL::OnDatatypeSelected ) 00048 00049 EVT_COMBOBOX( ID_FORMAT, GenerateRDL::OnFormatSelected ) 00050 00051 EVT_BUTTON( ID_BROWSE, GenerateRDL::OnBrowseClick ) 00052 00053 EVT_BUTTON( ID_BROWSE2, GenerateRDL::OnBrowse2Click ) 00054 00055 EVT_BUTTON( ID_BROWSE3, GenerateRDL::OnBrowse3Click ) 00056 00057 EVT_NOTEBOOK_PAGE_CHANGED( ID_NOTEBOOK, GenerateRDL::OnNotebookPageChanged ) 00058 00059 EVT_BUTTON( ID_GENERATE, GenerateRDL::OnGenerateClick ) 00060 00061 EVT_BUTTON( wxID_CANCEL, GenerateRDL::OnCancelClick ) 00062 00063 EVT_BUTTON( ID_ADD_COORDINATE, GenerateRDL::OnAddCoordinateClick ) 00064 00065 EVT_BUTTON( ID_DELETE_COORDINATE, GenerateRDL::OnDeleteCoordinateClick ) 00066 00067 EVT_GRID_CMD_CELL_CHANGE(ID_COORDINATE_GRID,GenerateRDL::OnCoordinateGridChange) 00068 00069 EVT_TEXT(ID_NAMESPACE, GenerateRDL::OnUpdateDMID) 00070 00071 EVT_TEXT(ID_LABEL, GenerateRDL::OnUpdateDMID) 00072 00073 EVT_TEXT(ID_FILENAME_PATTERN, GenerateRDL::OnUpdateVariables) 00074 00075 EVT_TEXT(ID_FILENAME_PATTERN2, GenerateRDL::OnUpdateVariables) 00076 00077 EVT_TEXT(ID_FILENAME_PATTERN3, GenerateRDL::OnUpdateVariables) 00078 00079 00080 END_EVENT_TABLE() 00081 00082 00083 //* 00084 // * GenerateRDL constructors 00085 // */ 00086 00087 GenerateRDL::GenerateRDL() 00088 { 00089 Init(); 00090 } 00091 00092 GenerateRDL::GenerateRDL( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) 00093 { 00094 Init(); 00095 Create( parent, id, caption, pos, size, style ); 00096 } 00097 00098 00099 /* 00100 * GenerateRDL creator 00101 */ 00102 00103 bool GenerateRDL::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) 00104 { 00105 wxFrame::Create( parent, id, caption, pos, size, style ); 00106 00107 CreateControls(); 00108 Centre(); 00109 return true; 00110 } 00111 00112 00113 /* 00114 * GenerateRDL destructor 00115 */ 00116 00117 GenerateRDL::~GenerateRDL() 00118 { 00119 } 00120 00121 00122 /* 00123 * Member initialisation 00124 */ 00125 00126 void GenerateRDL::Init() 00127 { 00128 m_datatype = NULL; 00129 m_filenamePattern = NULL; 00130 m_filenamePattern2 = NULL; 00131 m_filenamePattern3 = NULL; 00132 m_variableGrid = NULL; 00133 m_coordinateGrid = NULL; 00134 m_namespace = NULL; 00135 m_transformationUnits = NULL; 00136 } 00137 00138 00139 /* 00140 * Control creation for GenerateRDL 00141 */ 00142 00143 void GenerateRDL::CreateControls() 00144 { 00145 GenerateRDL* itemFrame1 = this; 00146 00147 wxMenuBar* menuBar = new wxMenuBar; 00148 wxMenu* itemMenu34 = new wxMenu; 00149 itemMenu34->Append(ID_MENU_NEW, _("New"), wxEmptyString, wxITEM_NORMAL); 00150 itemMenu34->Append(ID_MENU_OPEN, _("Open"), wxEmptyString, wxITEM_NORMAL); 00151 itemMenu34->Append(ID_MENU_SAVE, _("Save"), wxEmptyString, wxITEM_NORMAL); 00152 itemMenu34->AppendSeparator(); 00153 itemMenu34->Append(wxID_EXIT, _("Exit"), wxEmptyString, wxITEM_NORMAL); 00154 menuBar->Append(itemMenu34, _("File")); 00155 00156 wxMenu* itemMenu35 = new wxMenu; 00157 itemMenu35->Append(wxID_ANY, _("View Help"), wxEmptyString, wxITEM_NORMAL); 00158 itemMenu35->Append(wxID_ANY, _("About"), wxEmptyString, wxITEM_NORMAL); 00159 menuBar->Append(itemMenu35, _("Help")); 00160 00161 itemFrame1->SetMenuBar(menuBar); 00162 00163 wxPanel* itemPanel2 = new wxPanel( itemFrame1, ID_PANEL7, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); 00164 00165 wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL); 00166 itemPanel2->SetSizer(itemBoxSizer3); 00167 00168 wxRichTextCtrl* itemRichTextCtrl4 = new wxRichTextCtrl( itemPanel2, ID_TEXT, wxEmptyString, wxDefaultPosition, wxSize(100, 100), wxWANTS_CHARS ); 00169 itemBoxSizer3->Add(itemRichTextCtrl4, 0, wxGROW|wxGROW|wxALL, 5); 00170 00171 wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL); 00172 itemBoxSizer3->Add(itemBoxSizer4, 0, wxALIGN_LEFT|wxALL, 5); 00173 00174 wxStaticText* itemStaticText5 = new wxStaticText( itemPanel2, wxID_STATIC, _("Datatype"), wxDefaultPosition, wxDefaultSize, 0 ); 00175 itemBoxSizer4->Add(itemStaticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); 00176 00177 wxArrayString m_datatypeStrings; 00178 for(DataTypeList::iterator temp = DataType.begin(); temp != DataType.end(); temp++) { 00179 m_datatypeStrings.Add(temp->second); 00180 } 00181 m_datatype = new wxComboBox( itemPanel2, ID_DATATYPE, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_datatypeStrings, wxCB_DROPDOWN ); 00182 itemBoxSizer4->Add(m_datatype, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); 00183 00184 wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxHORIZONTAL); 00185 itemBoxSizer3->Add(itemBoxSizer7, 0, wxALIGN_LEFT|wxALL, 5); 00186 00187 wxStaticText* itemStaticText8 = new wxStaticText( itemPanel2, ID_STATIC_FORMAT_TEXT, _("Format"), wxDefaultPosition, wxDefaultSize, 0 ); 00188 itemStaticText8->Show(false); 00189 itemBoxSizer7->Add(itemStaticText8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); 00190 00191 wxArrayString itemComboBox9Strings; 00192 for(TransformFormatList::iterator temp = TransformFormat.begin(); temp != TransformFormat.end(); temp++) { 00193 itemComboBox9Strings.Add(temp->second); 00194 } 00195 wxComboBox *format = new wxComboBox( itemPanel2, ID_FORMAT, wxEmptyString, wxDefaultPosition, wxDefaultSize, itemComboBox9Strings, wxCB_DROPDOWN ); 00196 format->Show(false); 00197 itemBoxSizer7->Add(format, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); 00198 00199 wxFlexGridSizer* itemFlexGridSizer10 = new wxFlexGridSizer(0, 3, 0, 0); 00200 itemFlexGridSizer10->AddGrowableCol(1); 00201 itemBoxSizer3->Add(itemFlexGridSizer10, 0, wxGROW|wxALL, 5); 00202 00203 wxStaticText* itemStaticText11 = new wxStaticText( itemPanel2, ID_STATIC_FILEFORMAT1_TEXT, _("Filename pattern 1"), wxDefaultPosition, wxDefaultSize, 0 ); 00204 itemFlexGridSizer10->Add(itemStaticText11, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00205 00206 m_filenamePattern = new wxTextCtrl( itemPanel2, ID_FILENAME_PATTERN, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); 00207 itemFlexGridSizer10->Add(m_filenamePattern, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); 00208 00209 wxButton* itemButton13 = new wxButton( itemPanel2, ID_BROWSE, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); 00210 itemFlexGridSizer10->Add(itemButton13, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00211 00212 wxStaticText* itemStaticText14 = new wxStaticText( itemPanel2, ID_STATIC_FILEFORMAT2_TEXT, _("Filename pattern 2"), wxDefaultPosition, wxDefaultSize, 0 ); 00213 itemStaticText14->Show(false); 00214 itemFlexGridSizer10->Add(itemStaticText14, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00215 00216 m_filenamePattern2 = new wxTextCtrl( itemPanel2, ID_FILENAME_PATTERN2, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); 00217 m_filenamePattern2->Show(false); 00218 itemFlexGridSizer10->Add(m_filenamePattern2, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); 00219 00220 wxButton* itemButton16 = new wxButton( itemPanel2, ID_BROWSE2, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); 00221 itemButton16->Show(false); 00222 itemFlexGridSizer10->Add(itemButton16, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00223 00224 wxStaticText* itemStaticText17 = new wxStaticText( itemPanel2, ID_STATIC_FILEFORMAT3_TEXT, _("Filename pattern 3"), wxDefaultPosition, wxDefaultSize, 0 ); 00225 itemStaticText17->Show(false); 00226 itemFlexGridSizer10->Add(itemStaticText17, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00227 00228 m_filenamePattern3 = new wxTextCtrl( itemPanel2, ID_FILENAME_PATTERN3, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); 00229 m_filenamePattern3->Show(false); 00230 itemFlexGridSizer10->Add(m_filenamePattern3, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); 00231 00232 wxButton* itemButton19 = new wxButton( itemPanel2, ID_BROWSE3, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); 00233 itemButton19->Show(false); 00234 itemFlexGridSizer10->Add(itemButton19, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00235 00236 wxFlexGridSizer* itemFlexGridSizer20 = new wxFlexGridSizer(0, 2, 0, 0); 00237 itemFlexGridSizer20->AddGrowableCol(0); 00238 itemBoxSizer3->Add(itemFlexGridSizer20, 0, wxGROW|wxALL, 5); 00239 00240 m_variableGrid = new wxGrid( itemPanel2, ID_VARIABLE_GRID, wxDefaultPosition, wxSize(200, 150), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL ); 00241 m_variableGrid->SetDefaultColSize(150); 00242 m_variableGrid->SetDefaultRowSize(25); 00243 m_variableGrid->SetColLabelSize(25); 00244 m_variableGrid->SetRowLabelSize(50); 00245 m_variableGrid->CreateGrid(5, 2, wxGrid::wxGridSelectCells); 00246 itemFlexGridSizer20->Add(m_variableGrid, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00247 m_variableGrid->SetColLabelValue(0,"Variable"); 00248 m_variableGrid->SetColLabelValue(1,"Values"); 00249 00250 wxFlexGridSizer* itemFlexGridSizer22 = new wxFlexGridSizer(0, 2, 0, 0); 00251 itemFlexGridSizer22->AddGrowableCol(0); 00252 itemBoxSizer3->Add(itemFlexGridSizer22, 0, wxGROW|wxALL, 5); 00253 00254 m_coordinateGrid = new wxGrid( itemPanel2, ID_COORDINATE_GRID, wxDefaultPosition, wxSize(200, 150), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL ); 00255 m_coordinateGrid->SetDefaultColSize(150); 00256 m_coordinateGrid->SetDefaultRowSize(25); 00257 m_coordinateGrid->SetColLabelSize(25); 00258 m_coordinateGrid->SetRowLabelSize(150); 00259 m_coordinateGrid->CreateGrid(1, 2, wxGrid::wxGridSelectCells); 00260 itemFlexGridSizer22->Add(m_coordinateGrid, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00261 m_coordinateGrid->SetRowLabelValue(0,"Coordinate System 0"); 00262 m_coordinateGrid->SetColLabelValue(0,"Associated Variable"); 00263 m_coordinateGrid->SetColLabelValue(1,"Namespace (optional)"); 00264 00265 wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxHORIZONTAL); 00266 itemBoxSizer3->Add(itemBoxSizer24, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); 00267 00268 wxButton* itemButton25 = new wxButton( itemPanel2, ID_ADD_COORDINATE, _("Add Coordinate"), wxDefaultPosition, wxDefaultSize, 0 ); 00269 itemBoxSizer24->Add(itemButton25, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); 00270 00271 wxButton* itemButton26 = new wxButton( itemPanel2, ID_DELETE_COORDINATE, _("Delete Coordinate"), wxDefaultPosition, wxDefaultSize, 0 ); 00272 itemBoxSizer24->Add(itemButton26, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); 00273 00274 wxCheckBox* itemCheckBox27 = new wxCheckBox( itemPanel2, ID_REMOVE_DUPLICATES, _("Remove Identity Maps"), wxDefaultPosition, wxDefaultSize, 0 ); 00275 itemCheckBox27->SetValue(true); 00276 itemCheckBox27->Show(false); 00277 itemBoxSizer3->Add(itemCheckBox27, 0, wxALIGN_LEFT|wxALL, 5); 00278 00279 wxFlexGridSizer* itemFlexGridSizer28 = new wxFlexGridSizer(0, 2, 0, 0); 00280 itemFlexGridSizer28->AddGrowableCol(1); 00281 itemBoxSizer3->Add(itemFlexGridSizer28, 0, wxGROW|wxALL, 5); 00282 00283 wxStaticText* itemStaticText29 = new wxStaticText( itemPanel2, ID_STATIC_DEFAULT_NAMESPACE_TEXT, _("Default namespace"), wxDefaultPosition, wxDefaultSize, 0 ); 00284 itemFlexGridSizer28->Add(itemStaticText29, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00285 00286 m_namespace = new wxTextCtrl( itemPanel2, ID_NAMESPACE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); 00287 itemFlexGridSizer28->Add(m_namespace, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00288 00289 wxBoxSizer* itemBoxSizer31 = new wxBoxSizer(wxHORIZONTAL); 00290 itemBoxSizer3->Add(itemBoxSizer31, 0, wxALIGN_LEFT|wxALL, 5); 00291 00292 wxStaticText* itemStaticText32 = new wxStaticText( itemPanel2, ID_STATIC_TRANSFORMATION_UNITS_TEXT, _("Transformation units"), wxDefaultPosition, wxDefaultSize, 0 ); 00293 itemStaticText32->Show(false); 00294 itemBoxSizer31->Add(itemStaticText32, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); 00295 00296 wxArrayString m_transformationUnitsStrings; 00297 for(TransformUnitsList::iterator temp = TransformUnits.begin(); temp != TransformUnits.end(); temp++) { 00298 m_transformationUnitsStrings.Add(temp->second); 00299 } 00300 m_transformationUnits = new wxComboBox( itemPanel2, ID_TRANSFORMATION_UNITS, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_transformationUnitsStrings, wxCB_DROPDOWN ); 00301 m_transformationUnits->Show(false); 00302 itemBoxSizer31->Add(m_transformationUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); 00303 00304 wxFlexGridSizer* itemFlexGridSizer34 = new wxFlexGridSizer(0, 2, 0, 0); 00305 itemFlexGridSizer34->AddGrowableCol(1); 00306 itemBoxSizer3->Add(itemFlexGridSizer34, 0, wxGROW|wxALL, 5); 00307 00308 wxFlexGridSizer* itemFlexGridSizer37 = new wxFlexGridSizer(0, 2, 0, 0); 00309 itemFlexGridSizer37->AddGrowableCol(1); 00310 itemBoxSizer3->Add(itemFlexGridSizer37, 0, wxGROW|wxALL, 5); 00311 00312 wxStaticText* itemStaticText38 = new wxStaticText( itemPanel2, ID_STATIC_LABEL_TEXT, _("Label"), wxDefaultPosition, wxDefaultSize, 0 ); 00313 itemStaticText38->Show(false); 00314 itemFlexGridSizer37->Add(itemStaticText38, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00315 00316 wxTextCtrl* itemTextCtrl39 = new wxTextCtrl( itemPanel2, ID_LABEL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); 00317 itemTextCtrl39->Show(false); 00318 itemFlexGridSizer37->Add(itemTextCtrl39, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); 00319 00320 wxNotebook* itemNotebook40 = new wxNotebook( itemPanel2, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxBK_DEFAULT ); 00321 00322 wxPanel* itemPanel41 = new wxPanel( itemNotebook40, ID_DEFAULT_DMID, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); 00323 wxFlexGridSizer* itemFlexGridSizer42 = new wxFlexGridSizer(0, 2, 0, 0); 00324 itemFlexGridSizer42->AddGrowableCol(1); 00325 itemPanel41->SetSizer(itemFlexGridSizer42); 00326 00327 wxStaticText* itemStaticText43 = new wxStaticText( itemPanel41, wxID_STATIC, _("DMID"), wxDefaultPosition, wxDefaultSize, 0 ); 00328 itemFlexGridSizer42->Add(itemStaticText43, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00329 00330 wxTextCtrl* itemTextCtrl44 = new wxTextCtrl( itemPanel41, ID_DEFAULT_DMID_TEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); 00331 itemTextCtrl44->Enable(false); 00332 itemFlexGridSizer42->Add(itemTextCtrl44, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); 00333 00334 itemNotebook40->AddPage(itemPanel41, _("Default DMID")); 00335 00336 wxPanel* itemPanel45 = new wxPanel( itemNotebook40, ID_ADVANCED_DMID, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); 00337 wxFlexGridSizer* itemFlexGridSizer46 = new wxFlexGridSizer(0, 2, 0, 0); 00338 itemFlexGridSizer46->AddGrowableCol(1); 00339 itemPanel45->SetSizer(itemFlexGridSizer46); 00340 00341 wxStaticText* itemStaticText47 = new wxStaticText( itemPanel45, wxID_STATIC, _("DMID"), wxDefaultPosition, wxDefaultSize, 0 ); 00342 itemFlexGridSizer46->Add(itemStaticText47, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00343 00344 wxTextCtrl* itemTextCtrl48 = new wxTextCtrl( itemPanel45, ID_ADVANCED_DMID_TEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); 00345 itemFlexGridSizer46->Add(itemTextCtrl48, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); 00346 00347 itemNotebook40->AddPage(itemPanel45, _("Edit DMID")); 00348 00349 itemBoxSizer3->Add(itemNotebook40, 0, wxGROW|wxALL, 5); 00350 00351 wxBoxSizer* itemBoxSizer49 = new wxBoxSizer(wxHORIZONTAL); 00352 itemBoxSizer3->Add(itemBoxSizer49, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); 00353 00354 wxButton* itemButton50 = new wxButton( itemPanel2, ID_GENERATE, _("Generate"), wxDefaultPosition, wxDefaultSize, 0 ); 00355 itemBoxSizer49->Add(itemButton50, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); 00356 00357 wxButton* itemButton51 = new wxButton( itemPanel2, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); 00358 itemBoxSizer49->Add(itemButton51, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); 00359 } 00360 00361 00362 /* 00363 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_DATATYPE 00364 */ 00365 00366 void GenerateRDL::OnDatatypeSelected( wxCommandEvent& event ) 00367 { 00368 if(m_datatype->GetValue().compare(DataType.find("Image")->second.c_str() ) == 0 || m_datatype->GetValue().compare(DataType.find("Objectmap")->second.c_str()) == 0) { 00369 this->FindWindow(ID_LABEL)->Show(true); 00370 this->FindWindow(ID_STATIC_LABEL_TEXT)->Show(true); 00371 00372 this->FindWindow(ID_STATIC_FORMAT_TEXT)->Show(false); 00373 this->FindWindow(ID_FORMAT)->Show(false); 00374 this->FindWindow(ID_REMOVE_DUPLICATES)->Show(false); 00375 this->FindWindow(ID_TRANSFORMATION_UNITS)->Show(false); 00376 this->FindWindow(ID_STATIC_TRANSFORMATION_UNITS_TEXT)->Show(false); 00377 } 00378 else if(m_datatype->GetValue().compare(DataType.find("Transformation")->second.c_str() ) == 0) { 00379 this->FindWindow(ID_STATIC_FORMAT_TEXT)->Show(true); 00380 this->FindWindow(ID_FORMAT)->Show(true); 00381 this->FindWindow(ID_REMOVE_DUPLICATES)->Show(true); 00382 this->FindWindow(ID_TRANSFORMATION_UNITS)->Show(true); 00383 this->FindWindow(ID_STATIC_TRANSFORMATION_UNITS_TEXT)->Show(true); 00384 00385 this->FindWindow(ID_LABEL)->Show(false); 00386 this->FindWindow(ID_STATIC_LABEL_TEXT)->Show(false); 00387 } 00388 this->DisplayDMID(); 00389 00390 //Need to get the panel and do the layout of the panel 00391 //because the panel holds the sizer 00392 this->FindWindow(ID_PANEL7)->Layout(); 00393 m_variableGrid->Refresh(); 00394 m_coordinateGrid->Refresh(); 00395 this->Refresh(); 00396 this->FindWindow(ID_PANEL7)->Refresh(); 00397 } 00398 00399 00400 /* 00401 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_FORMAT 00402 */ 00403 00404 void GenerateRDL::OnFormatSelected( wxCommandEvent& event ) 00405 { 00406 if(event.GetString().compare(TransformFormat.find("Displacement3")->second.c_str()) == 0) { 00407 this->FindWindow(ID_STATIC_FILEFORMAT2_TEXT)->Show(true); 00408 this->FindWindow(ID_STATIC_FILEFORMAT3_TEXT)->Show(true); 00409 this->FindWindow(ID_FILENAME_PATTERN2)->Show(true); 00410 this->FindWindow(ID_BROWSE2)->Show(true); 00411 this->FindWindow(ID_FILENAME_PATTERN3)->Show(true); 00412 this->FindWindow(ID_BROWSE3)->Show(true); 00413 } 00414 else { 00415 this->FindWindow(ID_STATIC_FILEFORMAT2_TEXT)->Show(false); 00416 this->FindWindow(ID_STATIC_FILEFORMAT3_TEXT)->Show(false); 00417 this->FindWindow(ID_FILENAME_PATTERN2)->Show(false); 00418 this->FindWindow(ID_BROWSE2)->Show(false); 00419 this->FindWindow(ID_FILENAME_PATTERN3)->Show(false); 00420 this->FindWindow(ID_BROWSE3)->Show(false); 00421 } 00422 this->DisplayDMID(); 00423 00424 //Need to get the panel and do the layout of the panel 00425 //because the panel holds the sizer 00426 this->FindWindow(ID_PANEL7)->Layout(); 00427 m_variableGrid->Refresh(); 00428 m_coordinateGrid->Refresh(); 00429 00430 this->Refresh(); 00431 this->FindWindow(ID_PANEL7)->Refresh(); 00432 } 00433 00434 00435 /* 00436 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BROWSE 00437 */ 00438 00439 void GenerateRDL::OnBrowseClick( wxCommandEvent& event ) 00440 { 00441 wxFileDialog * filedialog = new wxFileDialog(this, wxT("Choose a file to use for the file pattern")); 00442 if( filedialog->ShowModal() == wxID_CANCEL ){ delete filedialog; return;} 00443 00444 m_filenamePattern->SetValue(filedialog->GetFilename() ); 00445 00446 delete filedialog; 00447 } 00448 00449 00450 /* 00451 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BROWSE2 00452 */ 00453 00454 void GenerateRDL::OnBrowse2Click( wxCommandEvent& event ) 00455 { 00456 wxFileDialog * filedialog = new wxFileDialog(this, wxT("Choose a file to use for the file pattern")); 00457 if( filedialog->ShowModal() == wxID_CANCEL ){ delete filedialog; return;} 00458 00459 m_filenamePattern2->SetValue(filedialog->GetFilename() ); 00460 00461 delete filedialog; 00462 } 00463 00464 00465 /* 00466 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BROWSE3 00467 */ 00468 00469 void GenerateRDL::OnBrowse3Click( wxCommandEvent& event ) 00470 { 00471 wxFileDialog * filedialog = new wxFileDialog(this, wxT("Choose a file to use for the file pattern")); 00472 if( filedialog->ShowModal() == wxID_CANCEL ){ delete filedialog; return;} 00473 00474 m_filenamePattern3->SetValue(filedialog->GetFilename() ); 00475 00476 delete filedialog; 00477 } 00478 00479 00480 /* 00481 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_GENERATE 00482 */ 00483 void GenerateRDL::OnGenerateClick( wxCommandEvent& event ) 00484 { 00485 wxString filenamePattern = m_filenamePattern->GetValue(); 00486 std::queue<ResourceDescription *> queueOfResourceDescription; 00487 queueOfResourceDescription = ExpandRD(filenamePattern); 00488 00489 ResourceDescriptionList *rdl = new ResourceDescriptionList(); 00490 rdl->SetNameSpace(m_namespace->GetValue().ToStdString()); 00491 00492 //Go through the queue that was created and move the data 00493 //over into the rdl 00494 int queueSize = queueOfResourceDescription.size(); 00495 for(int i=0; i< queueSize; i++) { 00496 std::string datatype = m_datatype->GetValue().ToStdString(); 00497 if(datatype.compare(DataType.find("Image")->second) == 0 || datatype.compare(DataType.find("Objectmap")->second) == 0) { 00498 rdl->AddDataDescrip(queueOfResourceDescription.front()->GetDMID(), queueOfResourceDescription.front()); 00499 } 00500 else if(datatype.compare(DataType.find("Transformation")->second) == 0) { 00501 rdl->AddTransformDescrip(queueOfResourceDescription.front()->GetDMID(), queueOfResourceDescription.front()); 00502 } 00503 else { 00504 delete queueOfResourceDescription.front(); 00505 } 00506 queueOfResourceDescription.pop(); 00507 } 00508 00509 //Display the rdl to the user, who can then 00510 //make changes to the text and also save 00511 //the rdl out to file 00512 ViewRDL *viewRDL = new ViewRDL(this,rdl); 00513 viewRDL->Show(); 00514 delete rdl; 00515 } 00516 00517 00518 //major re-change, now going to use ResourceDescription 00519 //The main logic of this is the following: 00520 //Go through m_variableGrid and get the variable 00521 //to be used and the values associated. 00522 //Then run through a while loop that will expand 00523 //a fifo queue with the subsition of variables 00524 //for values. 00525 //Example: 00526 // m_variableGrid holds: 00527 // a 01,02,03 00528 // b 01,02,03 00529 // 00530 // file name pattern: 00531 // na{a}_na{b}.warp 00532 // 00533 // Therefore this is what happens: 00534 // 1.) A blank ResourceDescription is created and put 00535 // into the queue along with the filename pattern 00536 // na{a}_na{b}.warp 00537 // 2.) run through the for loop 00538 // a.) first iteration of for loop 00539 // i.) Get the variable a and values 01,02,03 00540 // ii.) run through the while loop 00541 // A.) na{a}_na{b}.warp is popped off the queue 00542 // B.) na01_na{b}.warp 00543 // na02_na{b}.warp 00544 // na03_na{b}.warp 00545 // are all added to the queue 00546 // C.) na01_na{b}.warp is popped off the queue 00547 // D.) na01_na{b}.warp 00548 // is added to the queue and the while loop stops 00549 // b) next iteration of the for loop 00550 // i.) Get the variable b and values 01,02,03 00551 // ii.) run through the while loop 00552 // A.) na02_na{b}.warp is popped off the queue 00553 // B.) na02_na01.warp 00554 // na02_na02.warp 00555 // na02_na03.warp 00556 // are all added to the queue 00557 // C.) na03_na{b}.warp is popped off the queue 00558 // D.) na03_na01.warp 00559 // na03_na02.warp 00560 // na03_na03.warp 00561 // are all added to the queue 00562 // E.) na01_na{b}.warp is popped off the queue 00563 // F.) na01_na01.warp 00564 // na01_na02.warp 00565 // na01_na03.warp 00566 // are all added to the queue 00567 // G.) na02_na01.warp is popped off the queue 00568 // H.) na02_na01.warp 00569 // is added to the queue and the while loop stops 00570 std::queue<ResourceDescription *> GenerateRDL::ExpandRD(const wxString &pattern) 00571 { 00572 std::queue<ResourceDescription *> queueOfResourceDescription; 00573 ResourceDescription *resourceDescription = new ResourceDescription(std::string(m_namespace->GetValue().c_str())); 00574 //resourceDescription->AddAlgorithm("0", std::string(m_algorithm->GetValue().c_str())); 00575 if(m_coordinateGrid->GetNumberCols() == 3) { 00576 for(unsigned int i=1; i<m_coordinateGrid->GetNumberRows(); i++) { 00577 std::string index; 00578 std::stringstream out; 00579 out << i-1; 00580 index = out.str(); 00581 resourceDescription->AddAlgorithm(index, std::string(m_coordinateGrid->GetCellValue(i,2).c_str())); 00582 } 00583 } 00584 resourceDescription->SetDataType(std::string(m_datatype->GetValue().c_str())); 00585 resourceDescription->SetDefaultNS(std::string(m_namespace->GetValue().c_str())); 00586 resourceDescription->SetFormat(std::string(dynamic_cast<wxComboBox*>(this->FindWindow(ID_FORMAT))->GetValue().c_str())); 00587 resourceDescription->SetTransformUnits(std::string(m_transformationUnits->GetValue().c_str())); 00588 resourceDescription->SetLabel(std::string(dynamic_cast<wxTextCtrl*>(this->FindWindow(ID_LABEL))->GetValue().c_str())); 00589 00590 resourceDescription->AddFilename("0",std::string(pattern.c_str())); 00591 resourceDescription->SetDMID(std::string(dynamic_cast<wxTextCtrl *>(this->FindWindow(ID_ADVANCED_DMID_TEXT))->GetValue().c_str())); 00592 00593 queueOfResourceDescription.push(resourceDescription); 00594 00595 for(unsigned int i=0; i< m_variableGrid->GetNumberRows(); i++) { 00596 if( !m_variableGrid->GetCellValue(i,0).IsEmpty()) { 00597 //Create a temporary variable associated with the value 00598 //at m_variableGrid->GetCellValue(i,0), wrap 00599 //curly braces 00600 wxString variable = "{"; 00601 variable.Append(m_variableGrid->GetCellValue(i,0)); 00602 variable.Append("}"); 00603 00604 //Create temporary vector called tokens that 00605 //stores values that are assocated with variable 00606 wxString commaSeperatedvalues = m_variableGrid->GetCellValue(i,1); 00607 std::vector<wxString> vectorOfValues; 00608 this->Tokenize(commaSeperatedvalues,vectorOfValues,","); 00609 00610 00611 //figure out if m_variableGrid->GetCellValue(i,0) is associated with 00612 //m_coordinateGrid->GetCellValue(j,0) 00613 bool isCoordinate = false; 00614 int index = 0; 00615 for(unsigned int j=0; j<m_coordinateGrid->GetNumberRows(); j ++) { 00616 if(m_variableGrid->GetCellValue(i,0).compare(m_coordinateGrid->GetCellValue(j,0) ) == 0) { 00617 isCoordinate = true; 00618 index = j; 00619 } 00620 } 00621 00622 bool availableVariable= true; 00623 if(vectorOfValues.size()!= 0) { 00624 while(availableVariable) { 00625 if(queueOfResourceDescription.size() > 0) { 00626 ResourceDescription *tempResourceDescription = queueOfResourceDescription.front(); 00627 queueOfResourceDescription.pop(); 00628 00629 for(unsigned int i=0; i< vectorOfValues.size(); i++) { 00630 //need to make a copy of tempResourceDescription 00631 ResourceDescription *copyResourceDescription = new ResourceDescription(std::string(m_namespace->GetValue().c_str())); 00632 copyResourceDescription->SetDataType(tempResourceDescription->GetDataType()); 00633 copyResourceDescription->SetDefaultNS(tempResourceDescription->GetDefaultNS()); 00634 copyResourceDescription->SetFormat(tempResourceDescription->GetFormat()); 00635 copyResourceDescription->SetLabel(tempResourceDescription->GetLabel()); 00636 copyResourceDescription->SetTransformUnits(tempResourceDescription->GetTransformUnits()); 00637 copyResourceDescription->AddAlgorithm("0",tempResourceDescription->GetAlgorithm("0")); 00638 const ResourceDescription::CSList *cslist = tempResourceDescription->GetCS(); 00639 if(cslist != NULL) { 00640 for(ResourceDescription::CSList::const_iterator temp = cslist->begin(); temp!= cslist->end(); temp++) { 00641 copyResourceDescription->AddCS(temp->second.index,temp->second); 00642 } 00643 } 00644 00645 //Get the items that need to be replaced 00646 wxString tempFile = tempResourceDescription->GetFilename("0", false); 00647 wxString tempDmidString = tempResourceDescription->GetDMID(); 00648 wxString value = vectorOfValues.at(i); 00649 00650 00651 unsigned int dmidReplace = tempDmidString.Replace(variable,value); 00652 unsigned int fileReplace = tempFile.Replace(variable,value); 00653 00654 //Replace returns the number of items replaced, and so 00655 //if it is equal to zero, then nothing was replaced 00656 if(fileReplace == 0 && dmidReplace == 0 && availableVariable) { 00657 //Now we just need to push back the items that we popped off 00658 //the queues and get out of the while loop 00659 availableVariable = false; 00660 00661 //Make sure we update the copyResourceDescription with the up to date 00662 //DMID and filename 00663 copyResourceDescription->SetDMID(std::string(tempDmidString.c_str())); 00664 copyResourceDescription->AddFilename("0", std::string(tempFile.c_str())); 00665 queueOfResourceDescription.push(copyResourceDescription); 00666 } 00667 else if(dmidReplace != 0 && availableVariable && fileReplace == 0) { 00668 //Make sure we update the copyResourceDescription with the up to date 00669 //DMID and filename 00670 copyResourceDescription->SetDMID(std::string(tempDmidString.c_str())); 00671 copyResourceDescription->AddFilename("0", std::string(tempFile.c_str())); 00672 queueOfResourceDescription.push(copyResourceDescription); 00673 } 00674 else if(fileReplace != 0 && availableVariable) { 00675 copyResourceDescription->AddFilename("0", std::string(tempFile.c_str())); 00676 bool push = true; 00677 if(isCoordinate) { 00678 00679 //Figure out if the current value creates an identity 00680 if(dynamic_cast<wxCheckBox*>(this->FindWindow(ID_REMOVE_DUPLICATES))->GetValue()) { 00681 if(index > 0) { 00682 std::string previousIndexString; 00683 std::stringstream outTwo; 00684 outTwo << index-1; 00685 previousIndexString = outTwo.str(); 00686 if(copyResourceDescription->GetCS(previousIndexString)->id.compare(value.c_str()) == 0) { 00687 push = false; 00688 } 00689 outTwo.flush(); 00690 } 00691 } 00692 00693 //If the values are not an identity then create a new ResourceDescription::CoordinateSystem 00694 if(push) { 00695 ResourceDescription::CoordinateSystem cs; 00696 wxString indexString = wxString::Format(_T("%d"), index); 00697 cs.index = std::string(indexString.c_str() ); 00698 cs.id = std::string(value.c_str() ); 00699 if(!m_coordinateGrid->GetCellValue(index,1).IsEmpty() ) { 00700 cs.ns = std::string( m_coordinateGrid->GetCellValue(index,1).c_str() ); 00701 } else { 00702 cs.ns = std::string( m_namespace->GetValue().c_str() ); 00703 } 00704 copyResourceDescription->AddCS(cs.index, cs); 00705 } 00706 } 00707 00708 //If the values are not an identity then push onto the queue 00709 if(push) { 00710 copyResourceDescription->SetDMID(std::string(tempDmidString.c_str())); 00711 queueOfResourceDescription.push(copyResourceDescription); 00712 } else { 00713 //make sure that we delete any copies that aren't being used 00714 //otherwise we will have memory leaks 00715 delete copyResourceDescription; 00716 } 00717 } 00718 else{ 00719 //make sure that we delete any copies that aren't being used 00720 //otherwise we will have memory leaks 00721 delete copyResourceDescription; 00722 } 00723 00724 } 00725 delete tempResourceDescription; 00726 } 00727 } 00728 } 00729 } 00730 } 00731 return queueOfResourceDescription; 00732 } 00733 00734 00735 //Found this code from http://oopweb.com/CPP/Documents/CPPHOWTO/Volume/C++Programming-HOWTO-7.html 00736 //Had to modify a little bit 00737 void GenerateRDL::Tokenize(const wxString& str, 00738 std::vector<wxString>& tokens, 00739 const wxString& delimiters) 00740 { 00741 // Skip delimiters at beginning. 00742 wxString::size_type lastPos = str.find_first_not_of(delimiters, 0); 00743 // Find first "non-delimiter". 00744 //JAH added in this if statement 00745 wxString::size_type pos = wxString::npos; 00746 if(lastPos != wxString::npos) 00747 pos = str.find_first_of(delimiters, lastPos); 00748 00749 while (wxString::npos != pos || wxString::npos != lastPos) 00750 { 00751 // Found a token, add it to the vector. 00752 tokens.push_back(str.substr(lastPos, pos - lastPos)); 00753 // Skip delimiters. Note the "not_of" 00754 lastPos = str.find_first_not_of(delimiters, pos); 00755 // Find next "non-delimiter" 00756 //JAH added in this if statement 00757 if(lastPos != wxString::npos) 00758 pos = str.find_first_of(delimiters, lastPos); 00759 } 00760 } 00761 00762 00763 00764 /* 00765 * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL 00766 */ 00767 00768 void GenerateRDL::OnCancelClick( wxCommandEvent& event ) 00769 { 00770 this->Close(); 00771 } 00772 00773 00774 /* 00775 * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL 00776 */ 00777 00778 void GenerateRDL::OnAddCoordinateClick( wxCommandEvent& event ) 00779 { 00780 m_coordinateGrid->AppendRows(); 00781 wxString temp = "Coordinate System "; 00782 temp.Append(wxString::Format ("%i", m_coordinateGrid->GetNumberRows()-1)); 00783 m_coordinateGrid->SetRowLabelValue(m_coordinateGrid->GetNumberRows()-1,temp); 00784 if(m_coordinateGrid->GetNumberRows()>1 && m_coordinateGrid->GetNumberCols() != 3) { 00785 m_coordinateGrid->AppendCols(); 00786 m_coordinateGrid->SetColLabelValue(2,"Algorithm"); 00787 //m_coordinateGrid->SetCellValue("Please do not put an algorithm name here",0,2); 00788 m_coordinateGrid->SetReadOnly(0,2); 00789 } 00790 } 00791 00792 00793 /* 00794 * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL 00795 */ 00796 00797 void GenerateRDL::OnDeleteCoordinateClick( wxCommandEvent& event ) 00798 { 00799 m_coordinateGrid->DeleteRows(m_coordinateGrid->GetNumberRows()-1); 00800 if(m_coordinateGrid->GetNumberRows()<2 && m_coordinateGrid->GetNumberCols() == 3) { 00801 m_coordinateGrid->DeleteCols(2); 00802 } 00803 } 00804 00805 00806 /* 00807 * Should we show tooltips? 00808 */ 00809 00810 bool GenerateRDL::ShowToolTips() 00811 { 00812 return true; 00813 } 00814 00815 /* 00816 * Get bitmap resources 00817 */ 00818 00819 wxBitmap GenerateRDL::GetBitmapResource( const wxString& name ) 00820 { 00821 // Bitmap retrieval 00822 wxUnusedVar(name); 00823 return wxNullBitmap; 00824 } 00825 00826 /* 00827 * Get icon resources 00828 */ 00829 00830 wxIcon GenerateRDL::GetIconResource( const wxString& name ) 00831 { 00832 // Icon retrieval 00833 wxUnusedVar(name); 00834 return wxNullIcon; 00835 } 00836 00837 /* 00838 * wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED event handler for ID_NOTEBOOK 00839 */ 00840 00841 void GenerateRDL::OnNotebookPageChanged( wxNotebookEvent& event ) 00842 { 00843 00844 int id = event.GetId(); 00845 int selection = event.GetSelection(); 00846 int previous = event.GetOldSelection(); 00847 const wxWindowList temp = this->GetChildren(); 00848 wxNotebook *tempTwo = dynamic_cast<wxNotebook*>( this->FindWindow(id) ); 00849 wxTextCtrl *tempThree = dynamic_cast<wxTextCtrl*>( tempTwo->GetCurrentPage()->FindWindow(ID_DEFAULT_DMID_TEXT) ); 00850 wxTextCtrl *tempFour = dynamic_cast<wxTextCtrl*>( tempTwo->GetCurrentPage()->FindWindow(ID_ADVANCED_DMID_TEXT) ); 00851 if(previous != -1) { 00852 wxTextCtrl *defaultText = dynamic_cast<wxTextCtrl*>( tempTwo->GetPage(previous) ); 00853 00854 //make sure that any changes that were made in the advanced get shown in the default 00855 if(defaultText != NULL && tempFour != NULL) { 00856 defaultText->Clear(); 00857 defaultText->SetValue(tempFour->GetValue()); 00858 } 00859 } 00860 } 00861 00862 void GenerateRDL::DisplayDMID() 00863 { 00864 wxString dmid; 00865 00866 //Figure out what evaluator command to use 00867 if(DataType.find("Image")->second.compare(m_datatype->GetValue()) == 0 || DataType.find("Objectmap")->second.compare(m_datatype->GetValue()) == 0) { 00868 dmid = EvalCmd.find("SpatialData")->second; 00869 } else if(DataType.find("Transformation")->second.compare(m_datatype->GetValue()) == 0) { 00870 dmid = EvalCmd.find("Transformation")->second; 00871 } 00872 00873 00874 dmid.Append("("); 00875 //need to check the m_coordinate second column values 00876 //if there is a value in the second column then we 00877 //want to use that 00878 //add the namespace 00879 if(m_coordinateGrid->GetNumberRows() > 0) { 00880 if(!m_coordinateGrid->GetCellValue(0,1).IsEmpty() ) { 00881 dmid.Append(m_coordinateGrid->GetCellValue(0,1)); 00882 } else { 00883 dmid.Append(m_namespace->GetValue()); 00884 } 00885 } else { 00886 dmid.Append(m_namespace->GetValue()); 00887 } 00888 dmid.Append("|{"); 00889 if(m_coordinateGrid->GetNumberRows() > 0) { 00890 dmid.Append(m_coordinateGrid->GetCellValue(0,0)); 00891 } 00892 dmid.Append("},"); 00893 00894 00895 //Figure out which format we should use for DMID 00896 if(DataType.find("Image")->second.compare(m_datatype->GetValue()) == 0 || DataType.find("Objectmap")->second.compare(m_datatype->GetValue()) == 0) { 00897 dmid.Append( dynamic_cast<wxTextCtrl*>(this->FindWindow(ID_LABEL))->GetValue() ); 00898 } else if(DataType.find("Transformation")->second.compare(m_datatype->GetValue()) == 0) { 00899 if(m_coordinateGrid->GetNumberRows() > 0) { 00900 if(!m_coordinateGrid->GetCellValue(0,1).IsEmpty() ) { 00901 dmid.Append(m_coordinateGrid->GetCellValue(1,1)); 00902 } else { 00903 dmid.Append(m_namespace->GetValue()); 00904 } 00905 } else { 00906 dmid.Append(m_namespace->GetValue()); 00907 } 00908 dmid.Append("|{"); 00909 if(m_coordinateGrid->GetNumberRows() > 1) { 00910 dmid.Append(m_coordinateGrid->GetCellValue(1,0)); 00911 } 00912 dmid.Append("},"); 00913 if(m_coordinateGrid->GetNumberCols() == 3) { 00914 dmid.Append(m_coordinateGrid->GetCellValue(1,2)); 00915 } 00916 } 00917 dmid.Append(")"); 00918 00919 //Push the newly created DMID out to the text controls 00920 dynamic_cast<wxTextCtrl*>(this->FindWindow(ID_DEFAULT_DMID_TEXT))->SetValue(dmid); 00921 dynamic_cast<wxTextCtrl*>(this->FindWindow(ID_ADVANCED_DMID_TEXT))->SetValue(dmid); 00922 } 00923 00924 void GenerateRDL::OnCoordinateGridChange( wxGridEvent& event ) 00925 { 00926 this->DisplayDMID(); 00927 } 00928 00929 void GenerateRDL::OnUpdateDMID( wxCommandEvent& event ) 00930 { 00931 this->DisplayDMID(); 00932 } 00933 00934 void GenerateRDL::OnUpdateVariables( wxCommandEvent& event ) 00935 { 00936 //Figure out if a user put in a variable in the 00937 //filename pattern boxes. If the user did 00938 //then add the variable to m_variableGrid 00939 wxString pattern = event.GetString(); 00940 size_t first = pattern.find_first_of("{"); 00941 size_t second = pattern.find_first_of("}"); 00942 while(first != wxString::npos && second != wxString::npos) { 00943 wxString temp = pattern.substr(first+1, second - first-1); 00944 int i=0; 00945 bool insert = false; 00946 while(!insert) { 00947 if(m_variableGrid->GetNumberRows()-1 < i) { 00948 m_variableGrid->InsertRows(m_variableGrid->GetNumberRows()); 00949 } 00950 if(m_variableGrid->GetCellValue(i,0).compare(temp) == 0) { 00951 insert = true; 00952 } 00953 else if(m_variableGrid->GetCellValue(i,0).IsEmpty() ) { 00954 m_variableGrid->SetCellValue(temp, i, 0); 00955 insert = true; 00956 } 00957 i++; 00958 } 00959 first = pattern.find("{",first+1); 00960 second = pattern.find("}",second+1); 00961 } 00962 }