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

Method GetChartIndex

Charts/Core/vtkChartMatrix.cxx:475–498  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

473
474//------------------------------------------------------------------------------
475vtkVector2i vtkChartMatrix::GetChartIndex(const vtkVector2f& position)
476{
477 const bool isEmpty = this->Size.GetX() <= 0 && this->Size.GetY() <= 0;
478 if (isEmpty)
479 {
480 return { -1, -1 };
481 }
482
483 vtkVector2i index;
484 vtkVector2f offset, increment;
485
486 for (this->InitLayoutTraversal(index, offset, increment); !this->IsDoneWithTraversal();
487 this->GoToNextElement(index, offset))
488 {
489 const vtkRectf& rect = this->ComputeCurrentElementSceneRect(index, offset, increment);
490 vtkBoundingBox bbox(rect.GetLeft(), rect.GetRight(), rect.GetBottom(), rect.GetTop(),
491 VTK_DOUBLE_MIN, VTK_DOUBLE_MAX);
492 if (bbox.ContainsPoint(position.GetX(), position.GetY(), 0.0))
493 {
494 return this->Private->Index;
495 }
496 }
497 return vtkVector2i(-1, -1);
498}
499
500//------------------------------------------------------------------------------
501std::size_t vtkChartMatrix::GetFlatIndex(const vtkVector2i& index)

Callers 2

TestChartMatrix3Function · 0.80

Calls 7

InitLayoutTraversalMethod · 0.95
IsDoneWithTraversalMethod · 0.95
GoToNextElementMethod · 0.95
vtkVector2iClass · 0.50
GetXMethod · 0.45
ContainsPointMethod · 0.45

Tested by 1

TestChartMatrix3Function · 0.64