MCPcopy Create free account
hub / github.com/Kitware/VTK / UpdatePlotCache

Function UpdatePlotCache

Charts/Core/vtkChartXY.cxx:71–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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...

Callers

nothing calls this directly

Calls 8

clearMethod · 0.45
GetInputMethod · 0.45
findMethod · 0.45
endMethod · 0.45
GetNumberOfColumnsMethod · 0.45
GetColumnMethod · 0.45
GetDataMethod · 0.45

Tested by

no test coverage detected