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

Method UpdateCache

Charts/Core/vtkPlotBox.cxx:274–321  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

272}
273//------------------------------------------------------------------------------
274bool vtkPlotBox::UpdateCache()
275{
276 if (!this->Superclass::UpdateCache())
277 {
278 return false;
279 }
280
281 // Each boxplot is a column in our storage array,
282 // they are scaled from 0.0 to 1.0
283 vtkChartBox* parent = vtkChartBox::SafeDownCast(this->Parent);
284 vtkTable* table = this->Data->GetInput();
285 if (!parent || !table || table->GetNumberOfColumns() == 0)
286 {
287 return false;
288 }
289
290 vtkStringArray* cols = parent->GetVisibleColumns();
291
292 this->Storage->resize(cols->GetNumberOfTuples());
293 vtkIdType rows = table->GetNumberOfRows();
294
295 for (vtkIdType i = 0; i < cols->GetNumberOfTuples(); ++i)
296 {
297 std::vector<double>& col = this->Storage->at(i);
298 col.resize(rows);
299 vtkSmartPointer<vtkDataArray> data =
300 vtkArrayDownCast<vtkDataArray>(table->GetColumnByName(cols->GetValue(i).c_str()));
301 if (!data)
302 {
303 continue;
304 }
305
306 vtkAxis* axis = parent->GetYAxis();
307 // Also need the range from the appropriate axis, to normalize points
308 double min = axis->GetUnscaledMinimum();
309 double max = axis->GetUnscaledMaximum();
310 double scale = 1.0f / (max - min);
311
312 for (vtkIdType j = 0; j < rows; ++j)
313 {
314 col[j] = (data->GetTuple1(j) - min) * scale;
315 }
316 std::sort(col.begin(), col.end());
317 }
318
319 this->BuildTime.Modified();
320 return true;
321}
322
323//------------------------------------------------------------------------------
324void vtkPlotBox::SetLookupTable(vtkScalarsToColors* lut)

Callers

nothing calls this directly

Calls 15

GetColumnByNameMethod · 0.80
GetYAxisMethod · 0.80
GetTuple1Method · 0.80
sortFunction · 0.50
GetInputMethod · 0.45
GetNumberOfColumnsMethod · 0.45
GetVisibleColumnsMethod · 0.45
resizeMethod · 0.45
GetNumberOfTuplesMethod · 0.45
GetNumberOfRowsMethod · 0.45
atMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected