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

Method UpdateCache

Charts/Core/vtkPlotFunctionalBag.cxx:66–142  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

64
65//------------------------------------------------------------------------------
66bool vtkPlotFunctionalBag::UpdateCache()
67{
68 if (!this->Superclass::UpdateCache())
69 {
70 return false;
71 }
72
73 vtkTable* table = this->Data->GetInput();
74 if (!this->LookupTable)
75 {
76 this->CreateDefaultLookupTable();
77 this->LookupTable->SetRange(0, table->GetNumberOfColumns());
78 this->LookupTable->Build();
79 }
80
81 this->BagPoints->Reset();
82
83 vtkDataArray* array[2] = { nullptr, nullptr };
84 if (!this->GetDataArrays(table, array))
85 {
86 this->BuildTime.Modified();
87 return false;
88 }
89
90 if (array[1]->GetNumberOfComponents() == 1)
91 {
92 // The input array has one component, manage it as a line
93 this->Line->SetInputData(table, array[0] ? array[0]->GetName() : "", array[1]->GetName());
94 this->Line->SetUseIndexForXSeries(this->UseIndexForXSeries);
95 this->Line->SetMarkerStyle(vtkPlotPoints::NONE);
96 this->Line->SetPen(this->Pen);
97 this->Line->SetBrush(this->Brush);
98 this->Line->Update();
99 }
100 else if (array[1]->GetNumberOfComponents() == 2)
101 {
102 // The input array has 2 components, this must be a bag
103 // with {miny,maxy} tuples
104 vtkDoubleArray* darr = vtkArrayDownCast<vtkDoubleArray>(array[1]);
105
106 this->LogX = this->XAxis->GetLogScaleActive();
107 this->LogY = this->YAxis->GetLogScaleActive();
108 bool xAbs = this->XAxis->GetUnscaledMinimum() < 0.;
109 bool yAbs = this->YAxis->GetUnscaledMinimum() < 0.;
110 if (darr)
111 {
112 vtkIdType nbRows = array[1]->GetNumberOfTuples();
113 this->BagPoints->SetNumberOfPoints(2 * nbRows);
114 for (vtkIdType i = 0; i < nbRows; i++)
115 {
116 double y[2];
117 darr->GetTuple(i, y);
118
119 double x = (!this->UseIndexForXSeries && array[0]) ? array[0]->GetVariantValue(i).ToDouble()
120 : static_cast<double>(i);
121 if (this->LogX)
122 {
123 x = xAbs ? log10(fabs(x)) : log10(x);

Callers

nothing calls this directly

Calls 15

GetDataArraysMethod · 0.95
SetBrushMethod · 0.80
log10Function · 0.50
GetInputMethod · 0.45
SetRangeMethod · 0.45
GetNumberOfColumnsMethod · 0.45
BuildMethod · 0.45
ResetMethod · 0.45
ModifiedMethod · 0.45
GetNumberOfComponentsMethod · 0.45
SetInputDataMethod · 0.45

Tested by

no test coverage detected