Commit b0429b75 authored by Marcus D. Hanwell's avatar Marcus D. Hanwell
Browse files

ENH: Change vtkPlot::GetNearestPoint return type.

This function returned int, but it is much more appropriate to use
vtkIdType here.

Change-Id: Ib2bc735dcd1d9f447b855013ad18c4e3befcc18d
parent c0de397f
......@@ -79,8 +79,8 @@ bool vtkPlot::PaintLegend(vtkContext2D*, const vtkRectf&, int)
}
//-----------------------------------------------------------------------------
int vtkPlot::GetNearestPoint(const vtkVector2f&, const vtkVector2f&,
vtkVector2f*)
vtkIdType vtkPlot::GetNearestPoint(const vtkVector2f&, const vtkVector2f&,
vtkVector2f*)
{
return -1;
}
......
......@@ -57,11 +57,11 @@ public:
//BTX
// Description:
// Function to query a plot for the nearest point to the specified coordinate.
// Returns the index of the data series with which the point is associated or
// -1.
virtual int GetNearestPoint(const vtkVector2f& point,
const vtkVector2f& tolerance,
vtkVector2f* location);
// Returns the index of the data series with which the point is associated, or
// -1 if no point was found.
virtual vtkIdType GetNearestPoint(const vtkVector2f& point,
const vtkVector2f& tolerance,
vtkVector2f* location);
// Description:
// Select all points in the specified rectangle.
......
......@@ -240,8 +240,8 @@ class vtkPlotBarSegment : public vtkObject {
}
}
int GetNearestPoint(const vtkVector2f& point, vtkVector2f* location,
float width, float offset, int orientation)
vtkIdType GetNearestPoint(const vtkVector2f& point, vtkVector2f* location,
float width, float offset, int orientation)
{
if (!this->Points && this->Points->GetNumberOfPoints())
{
......@@ -432,9 +432,9 @@ public:
}
int GetNearestPoint(const vtkVector2f& point, vtkVector2f* location,
float width, float offset, int orientation,
vtkIdType* segmentIndex)
vtkIdType GetNearestPoint(const vtkVector2f& point, vtkVector2f* location,
float width, float offset, int orientation,
vtkIdType* segmentIndex)
{
vtkIdType segmentIndexCtr = 0;
for (std::vector<vtkSmartPointer<vtkPlotBarSegment> >::iterator it =
......@@ -679,19 +679,19 @@ void vtkPlotBar::GetColor(double rgb[3])
}
//-----------------------------------------------------------------------------
int vtkPlotBar::GetNearestPoint(const vtkVector2f& point,
const vtkVector2f&,
vtkVector2f* location)
vtkIdType vtkPlotBar::GetNearestPoint(const vtkVector2f& point,
const vtkVector2f&,
vtkVector2f* location)
{
return this->Private->GetNearestPoint(point, location, this->Width,
this->Offset, this->Orientation, 0);
}
//-----------------------------------------------------------------------------
int vtkPlotBar::GetNearestPoint(const vtkVector2f& point,
const vtkVector2f&,
vtkVector2f* location,
vtkIdType* segmentIndex)
vtkIdType vtkPlotBar::GetNearestPoint(const vtkVector2f& point,
const vtkVector2f&,
vtkVector2f* location,
vtkIdType* segmentIndex)
{
return this->Private->GetNearestPoint(point, location, this->Width,
this->Offset, this->Orientation,
......
......@@ -126,11 +126,11 @@ public:
//BTX
// Description:
// Function to query a plot for the nearest point to the specified coordinate.
// Returns the index of the data series with which the point is associated or
// Returns the index of the data series with which the point is associated or
// -1.
virtual int GetNearestPoint(const vtkVector2f& point,
const vtkVector2f& tolerance,
vtkVector2f* location);
virtual vtkIdType GetNearestPoint(const vtkVector2f& point,
const vtkVector2f& tolerance,
vtkVector2f* location);
// Description:
// Function to query a plot for the nearest point to the specified coordinate.
......@@ -138,10 +138,10 @@ public:
// -1.
// If a vtkIdType* is passed, its referent will be set to index of the bar
// segment with which a point is associated, or -1.
virtual int GetNearestPoint(const vtkVector2f& point,
const vtkVector2f&,
vtkVector2f* location,
vtkIdType* segmentIndex);
virtual vtkIdType GetNearestPoint(const vtkVector2f& point,
const vtkVector2f&,
vtkVector2f* location,
vtkIdType* segmentIndex);
protected:
vtkPlotBar();
......
......@@ -215,14 +215,6 @@ void vtkPlotParallelCoordinates::GetBounds(double *)
}
//-----------------------------------------------------------------------------
int vtkPlotParallelCoordinates::GetNearestPoint(const vtkVector2f& ,
const vtkVector2f& ,
vtkVector2f* )
{
return -1;
}
//-----------------------------------------------------------------------------
bool vtkPlotParallelCoordinates::SetSelectionRange(int axis, float low,
float high)
......
......@@ -64,14 +64,6 @@ public:
// Get the bounds for this mapper as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
virtual void GetBounds(double bounds[4]);
//BTX
// Description:
// Function to query a plot for the nearest point to the specified coordinate.
virtual int GetNearestPoint(const vtkVector2f& point,
const vtkVector2f& tolerance,
vtkVector2f* location);
//ETX
// Description:
// Set the selection criteria on the given axis in normalized space (0.0 - 1.0).
bool SetSelectionRange(int Axis, float low, float high);
......
......@@ -199,8 +199,9 @@ vtkColorSeries *vtkPlotPie::GetColorSeries()
}
//-----------------------------------------------------------------------------
int vtkPlotPie::GetNearestPoint(const vtkVector2f& point, const vtkVector2f&,
vtkVector2f* values)
vtkIdType vtkPlotPie::GetNearestPoint(const vtkVector2f& point,
const vtkVector2f&,
vtkVector2f* values)
{
float x = point.X() - this->Private->CenterX;
float y = point.Y() - this->Private->CenterY;
......
......@@ -76,10 +76,9 @@ public:
// Function to query a plot for the nearest point to the specified coordinate.
// Returns the index of the data series with which the point is associated or
// -1.
virtual int GetNearestPoint(const vtkVector2f& point,
const vtkVector2f& tolerance,
vtkVector2f* location
);
virtual vtkIdType GetNearestPoint(const vtkVector2f& point,
const vtkVector2f& tolerance,
vtkVector2f* location);
protected:
vtkPlotPie();
......
......@@ -499,9 +499,9 @@ void vtkPlotPoints::CreateSortedPoints()
}
//-----------------------------------------------------------------------------
int vtkPlotPoints::GetNearestPoint(const vtkVector2f& point,
const vtkVector2f& tol,
vtkVector2f* location)
vtkIdType vtkPlotPoints::GetNearestPoint(const vtkVector2f& point,
const vtkVector2f& tol,
vtkVector2f* location)
{
// Right now doing a simple bisector search of the array.
if (!this->Points)
......
......@@ -103,9 +103,9 @@ public:
// Function to query a plot for the nearest point to the specified coordinate.
// Returns the index of the data series with which the point is associated or
// -1.
virtual int GetNearestPoint(const vtkVector2f& point,
const vtkVector2f& tolerance,
vtkVector2f* location);
virtual vtkIdType GetNearestPoint(const vtkVector2f& point,
const vtkVector2f& tolerance,
vtkVector2f* location);
// Description:
// Select all points in the specified rectangle.
......
......@@ -476,9 +476,9 @@ class vtkPlotStackedPrivate {
}
int GetNearestPoint(const vtkVector2f& point,
const vtkVector2f& tol,
vtkVector2f* location)
vtkIdType GetNearestPoint(const vtkVector2f& point,
const vtkVector2f& tol,
vtkVector2f* location)
{
// Depends on the fact that we check the segments in order. Each
// Segment only worrys about its own total extent from the base.
......@@ -673,7 +673,7 @@ void vtkPlotStacked::GetBounds(double bounds[4])
}
//-----------------------------------------------------------------------------
int vtkPlotStacked::GetNearestPoint(const vtkVector2f& point,
vtkIdType vtkPlotStacked::GetNearestPoint(const vtkVector2f& point,
const vtkVector2f& tol,
vtkVector2f* location)
{
......
......@@ -94,9 +94,9 @@ public:
// Function to query a plot for the nearest point to the specified coordinate.
// Returns the index of the data series with which the point is associated or
// -1.
virtual int GetNearestPoint(const vtkVector2f& point,
const vtkVector2f& tolerance,
vtkVector2f* location);
virtual vtkIdType GetNearestPoint(const vtkVector2f& point,
const vtkVector2f& tolerance,
vtkVector2f* location);
// Description:
// Select all points in the specified rectangle.
......
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