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

Method UpdateCache

Charts/Core/vtkPlotHistogram2D.cxx:298–331  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

296
297//------------------------------------------------------------------------------
298bool vtkPlotHistogram2D::UpdateCache()
299{
300 if (!this->Input)
301 {
302 return false;
303 }
304 if (!this->Output)
305 {
306 this->Output = vtkSmartPointer<vtkImageData>::New();
307 }
308 this->Output->SetExtent(this->Input->GetExtent());
309 this->Output->AllocateScalars(VTK_UNSIGNED_CHAR, 4);
310
311 if (this->TransferFunction)
312 {
313 vtkDataArray* inputDataArray = nullptr;
314 void* const inputVoidArray = this->GetInputArrayPointer(inputDataArray);
315
316 if (!inputVoidArray || !inputDataArray)
317 {
318 return false;
319 }
320
321 const int inputType = inputDataArray->GetDataType();
322 const int nbComponents = inputDataArray->GetNumberOfComponents();
323 const int dimension = this->Input->GetDimensions()[0] * this->Input->GetDimensions()[1];
324 unsigned char* output = reinterpret_cast<unsigned char*>(this->Output->GetScalarPointer());
325
326 this->TransferFunction->MapScalarsThroughTable2(
327 inputVoidArray, output, inputType, dimension, nbComponents, 4);
328 }
329
330 return true;
331}
332
333//------------------------------------------------------------------------------
334void* vtkPlotHistogram2D::GetInputArrayPointer(vtkDataArray*& inputArray)

Callers 1

UpdateMethod · 0.95

Calls 10

GetInputArrayPointerMethod · 0.95
GetScalarPointerMethod · 0.80
NewFunction · 0.50
SetExtentMethod · 0.45
GetExtentMethod · 0.45
AllocateScalarsMethod · 0.45
GetDataTypeMethod · 0.45
GetNumberOfComponentsMethod · 0.45
GetDimensionsMethod · 0.45

Tested by

no test coverage detected