Update VarOrderPtree based on meta-data from TableInterface */
| 312 | /** Update VarOrderPtree based on meta-data from TableInterface |
| 313 | */ |
| 314 | void VarOrderPtree::ReInitFromTableInt(TableInterface* table) |
| 315 | { |
| 316 | if (!table) return; |
| 317 | |
| 318 | var_grps.clear(); |
| 319 | time_ids.clear(); |
| 320 | |
| 321 | std::vector<wxString> tm_strs; |
| 322 | table->GetTimeStrings(tm_strs); |
| 323 | int times = table->GetTimeSteps(); |
| 324 | int cols = table->GetNumberCols(); |
| 325 | this->time_ids.resize(times); |
| 326 | for (int t=0; t<times; ++t) { |
| 327 | this->time_ids[t] = tm_strs[t].ToStdString(); |
| 328 | } |
| 329 | std::vector<int> col_map; |
| 330 | table->FillColIdMap(col_map); |
| 331 | for (int i=0; i<cols; ++i) { |
| 332 | int col = col_map[i]; |
| 333 | VarGroup e; |
| 334 | e.name = table->GetColName(col); |
| 335 | if (table->IsColTimeVariant(col)) { |
| 336 | e.vars.resize(times); |
| 337 | for (int t=0; t<times; ++t) { |
| 338 | if (table->GetColType(col, t) == GdaConst::placeholder_type) { |
| 339 | e.vars[t] = ""; |
| 340 | } else { |
| 341 | e.vars[t] = table->GetColName(col, t); |
| 342 | } |
| 343 | } |
| 344 | } |
| 345 | e.displayed_decimals = table->GetColDispDecimals(col); |
| 346 | e.meta_data = table->GetMetaData(col); |
| 347 | this->var_grps.push_back(e); |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | wxString VarOrderPtree::VarOrderToStr() const |
| 352 | { |
no test coverage detected