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

Method GetInputArrayValue

Charts/Core/vtkPlotHistogram2D.cxx:376–409  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

374
375//------------------------------------------------------------------------------
376double vtkPlotHistogram2D::GetInputArrayValue(int x, int y, int z)
377{
378 vtkDataArray* selectedArray = this->GetSelectedArray();
379 if (!selectedArray)
380 {
381 vtkErrorMacro("Trying to get value while no array was selected.");
382 return std::nan("");
383 }
384
385 int coordinates[3] = { x, y, z };
386 vtkIdType index = this->Input->GetTupleIndex(selectedArray, coordinates);
387
388 if (index < 0)
389 {
390 // An error message was already generated by GetTupleIndex.
391 return std::nan("");
392 }
393
394 if (!this->TransferFunction)
395 {
396 vtkErrorMacro("Trying to get value while no transfer function was set.");
397 return std::nan("");
398 }
399
400 int vectorMode = this->TransferFunction->GetVectorMode();
401 if (vtkPlotHistogram2D::CanComputeMagnitude(selectedArray) &&
402 vectorMode == vtkScalarsToColors::VectorModes::MAGNITUDE)
403 {
404 return this->MagnitudeArray->GetTuple1(index);
405 }
406
407 int vectorComponent = this->TransferFunction->GetVectorComponent();
408 return selectedArray->GetComponent(index, vectorComponent);
409}
410
411//------------------------------------------------------------------------------
412bool vtkPlotHistogram2D::CanComputeMagnitude(vtkDataArray* array)

Callers 1

GetTooltipLabelMethod · 0.95

Calls 4

GetSelectedArrayMethod · 0.95
GetTupleIndexMethod · 0.80
GetTuple1Method · 0.80
GetComponentMethod · 0.45

Tested by

no test coverage detected