| 69 | } |
| 70 | |
| 71 | void UpdatePlotCache() |
| 72 | { |
| 73 | if (!this->PlotCacheUpdated) |
| 74 | { |
| 75 | this->PlotCache.clear(); |
| 76 | |
| 77 | // build map to find array index from its pointer to speed up access |
| 78 | // the table should be shared between all plots |
| 79 | std::unordered_map<vtkTable*, std::unordered_map<vtkAbstractArray*, vtkIdType>> colMap; |
| 80 | for (vtkPlot* plot : this->plots) |
| 81 | { |
| 82 | vtkTable* table = plot->GetInput(); |
| 83 | if (table) |
| 84 | { |
| 85 | auto it = colMap.find(table); |
| 86 | if (it == colMap.end()) |
| 87 | { |
| 88 | std::unordered_map<vtkAbstractArray*, vtkIdType> tableColMap; |
| 89 | |
| 90 | vtkIdType nbCols = table->GetNumberOfColumns(); |
| 91 | for (vtkIdType i = 0; i < nbCols; i++) |
| 92 | { |
| 93 | tableColMap[table->GetColumn(i)] = i; |
| 94 | } |
| 95 | |
| 96 | colMap[table] = std::move(tableColMap); |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | // build map to find plot from column index |
| 102 | for (vtkPlot* plot : this->plots) |
| 103 | { |
| 104 | vtkTable* table = plot->GetInput(); |
| 105 | |
| 106 | constexpr int idx = 1; // column |
| 107 | vtkAbstractArray* array = plot->GetData()->GetInputAbstractArrayToProcess(idx, table); |
| 108 | |
| 109 | this->PlotCache[colMap[table][array]] = plot; |
| 110 | } |
| 111 | |
| 112 | this->PlotCacheUpdated = true; |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | std::vector<vtkPlot*> plots; // Charts can contain multiple plots of data |
| 117 | std::vector<vtkContextTransform*> PlotCorners; // Stored by corner... |
nothing calls this directly
no test coverage detected