| 78 | } |
| 79 | |
| 80 | void updateArrayGroups(ArrayGroupModel& model, vtkCellGridCellSource* cellSource, |
| 81 | QComboBox* groupSelector, bool signalChange = true) |
| 82 | { |
| 83 | cellSource->Update(); |
| 84 | int idx = -1; |
| 85 | groupSelector->clear(); |
| 86 | auto* cellGrid = cellSource->GetOutput(); |
| 87 | auto curGroupName = model.groupName(); |
| 88 | for (const auto& entry : cellGrid->GetArrayGroups()) |
| 89 | { |
| 90 | vtkStringToken groupName(static_cast<vtkStringToken::Hash>(entry.first)); |
| 91 | if (groupName.IsValid() && groupName.HasData()) |
| 92 | { |
| 93 | if (groupName == curGroupName) |
| 94 | { |
| 95 | idx = groupSelector->count(); |
| 96 | } |
| 97 | groupSelector->addItem(QString::fromStdString(groupName.Data())); |
| 98 | } |
| 99 | } |
| 100 | if (idx < 0 && groupSelector->count() > 0) |
| 101 | { |
| 102 | idx = 0; |
| 103 | curGroupName = groupSelector->currentText().toStdString(); |
| 104 | } |
| 105 | model.setGroupName(curGroupName, signalChange); |
| 106 | } |
| 107 | |
| 108 | } // anonymous namespace |
| 109 | |