MCPcopy Create free account
hub / github.com/GeoDaCenter/geoda / OnGroupVariables

Method OnGroupVariables

DataViewer/TableFrame.cpp:574–609  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

572};
573
574void TableFrame::OnGroupVariables( wxCommandEvent& event)
575{
576 TableInterface* ti = table_base->GetTableInt();
577 std::vector<int> sel_cols;
578 table_base->GetSelectedCols(sel_cols);
579 std::vector<cid_to_pos_pair> cid_to_disp(sel_cols.size());
580 for (int i=0; i<sel_cols.size(); i++) {
581 cid_to_pos_pair p;
582 p.cid = sel_cols[i];
583 p.pos = grid->GetColPos(sel_cols[i]);
584 cid_to_disp[i] = p;
585 }
586 sort(cid_to_disp.begin(), cid_to_disp.end(), cid_to_pos_pair::less_than);
587 for (int i=0; i<sel_cols.size(); i++) {
588 sel_cols[i] = cid_to_disp[i].cid;
589 }
590
591 std::vector<wxString> names(sel_cols.size());
592 for (int i=0; i<sel_cols.size(); ++i) names[i]=ti->GetColName(sel_cols[i]);
593 wxString grp_nm = ti->SuggestGroupName(names);
594 if (sel_cols.size() > 0) {
595 if (ti->GetTimeSteps() == 1 && sel_cols.size() > 1) {
596 if (table_state->GetNumDisallowTimelineChanges() > 0) {
597 wxString msg = table_state->GetDisallowTimelineChangesMsg();
598 wxMessageDialog dlg (this, msg, _("Warning"),
599 wxOK | wxICON_INFORMATION);
600 dlg.ShowModal();
601 return;
602 }
603 }
604 ti->GroupCols(sel_cols, grp_nm, sel_cols[0]);
605 }
606 table_base->DeselectAllCols();
607 grid->Refresh();
608 GdaFrame::GetGdaFrame()->UpdateToolbarAndMenus();
609}
610
611void TableFrame::OnUnGroupVariable(wxCommandEvent& event )
612{

Callers

nothing calls this directly

Calls 13

GetSelectedColsMethod · 0.80
SuggestGroupNameMethod · 0.80
GroupColsMethod · 0.80
DeselectAllColsMethod · 0.80
UpdateToolbarAndMenusMethod · 0.80
sortFunction · 0.50
GetTableIntMethod · 0.45
sizeMethod · 0.45
GetColNameMethod · 0.45
GetTimeStepsMethod · 0.45

Tested by

no test coverage detected