Commit 1dcc3d96 authored by Joachim Pouderoux's avatar Joachim Pouderoux

Add functions to get data bounds and number of plotted bars.

Those functions will be used for a PV improvement.

Change-Id: Idb4f4fdd2558d6cb7b7c936697e923fd7ea3ff3a
parent f0480df1
......@@ -1113,3 +1113,36 @@ vtkStdString vtkPlotBar::GetTooltipLabel(const vtkVector2d &plotPos,
}
return tooltipLabel;
}
//-----------------------------------------------------------------------------
int vtkPlotBar::GetBarsCount()
{
vtkTable *table = this->Data->GetInput();
if (!table)
{
vtkWarningMacro(<< "GetBarsCount called with no input table set.");
return 0;
}
vtkDataArray* x = this->Data->GetInputArrayToProcess(0, table);
return x ? x->GetNumberOfTuples() : 0;
}
//-----------------------------------------------------------------------------
void vtkPlotBar::GetDataBounds(double bounds[2])
{
assert(bounds);
// Get the x and y arrays (index 0 and 1 respectively)
vtkTable *table = this->Data->GetInput();
if (!table)
{
vtkWarningMacro(<< "GetDataBounds called with no input table set.");
bounds[0] = VTK_DOUBLE_MAX;
bounds[1] = VTK_DOUBLE_MIN;
return;
}
vtkDataArray* x = this->Data->GetInputArrayToProcess(0, table);
if (x)
{
x->GetRange(bounds);
}
}
......@@ -192,6 +192,14 @@ public:
vtkVector2f* location,
vtkIdType* segmentIndex);
// Description:
// Get amount of plotted bars.
int GetBarsCount();
// Description:
// Get the data bounds for this mapper as (Xmin,Xmax).
void GetDataBounds(double bounds[2]);
protected:
vtkPlotBar();
~vtkPlotBar();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment