| 827 | } |
| 828 | |
| 829 | void MainWindow::CaseVarGrid(std::vector<Case*> &cases) |
| 830 | { |
| 831 | if (cases.size() > 0) |
| 832 | { |
| 833 | wxArrayString col_hdrs; |
| 834 | wxString title; |
| 835 | std::vector<VarTable> var_table_vec; |
| 836 | std::vector<VarInfoLookup> var_info_lookup_vec; |
| 837 | if (cases.size() == 1) |
| 838 | { |
| 839 | col_hdrs.push_back("Variable"); |
| 840 | col_hdrs.push_back("Label"); |
| 841 | wxString case_name = m_project.GetCaseName(cases[0]); |
| 842 | col_hdrs.push_back(case_name); |
| 843 | title = "Inputs Browser"; //: " + case_name; |
| 844 | var_table_vec.push_back(cases[0]->Values(0)); // TODO - handle hybrid technologies |
| 845 | var_info_lookup_vec.push_back(cases[0]->Variables(0)); |
| 846 | } |
| 847 | else |
| 848 | { |
| 849 | title = "Inputs Browser"; //Case comparison"; |
| 850 | col_hdrs = m_project.GetCaseNames(); |
| 851 | col_hdrs.Insert("Label", 0); |
| 852 | col_hdrs.Insert("Variable", 0); |
| 853 | for (std::vector<Case*>::iterator it = cases.begin(); it != cases.end(); ++it) |
| 854 | { |
| 855 | var_table_vec.push_back((*it)->Values(0)); // TODO - handle hybrid technologies |
| 856 | var_info_lookup_vec.push_back((*it)->Variables(0)); |
| 857 | } |
| 858 | } |
| 859 | |
| 860 | wxFrame *frame = new wxFrame(this, wxID_ANY, title, wxDefaultPosition, wxScaleSize(400, 700)); |
| 861 | wxGrid *grid = new wxGrid(frame, wxID_ANY); |
| 862 | |
| 863 | size_t num_cols = col_hdrs.Count(); |
| 864 | |
| 865 | // variable names |
| 866 | std::set<wxString> var_names; |
| 867 | |
| 868 | for (std::vector<VarTable>::iterator it = var_table_vec.begin(); it != var_table_vec.end(); ++it) |
| 869 | { |
| 870 | wxArrayString as = it->ListAll(); |
| 871 | for (size_t i = 0; i < as.Count();i++) |
| 872 | var_names.insert(as[i]); |
| 873 | } |
| 874 | size_t num_rows = var_names.size(); |
| 875 | |
| 876 | // variable labels |
| 877 | wxArrayString var_labels; |
| 878 | |
| 879 | for (std::set<wxString>::iterator idx = var_names.begin(); idx != var_names.end(); ++idx) |
| 880 | { |
| 881 | wxString str_label = " "; |
| 882 | for (std::vector<VarInfoLookup>::iterator it = var_info_lookup_vec.begin(); it != var_info_lookup_vec.end(); ++it) |
| 883 | { |
| 884 | if ((*it).Lookup(*idx)) |
| 885 | str_label = (*it).Label(*idx); |
| 886 | } |
nothing calls this directly
no test coverage detected