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

ENH: Use vtkRectf instead of float* in legend.

Specify the legend area using the vtkRectf data type.

Change-Id: Icf9c101bc5705e9fa11a431d91b059a930d77716
parent 311190bf
......@@ -155,7 +155,7 @@ bool vtkChartLegend::Paint(vtkContext2D *painter)
labels->GetValue(l));
// Paint the legend mark and increment out y value.
this->Storage->ActivePlots[i]->PaintLegend(painter, rect.GetData(), l);
this->Storage->ActivePlots[i]->PaintLegend(painter, rect, l);
rect.SetY(rect.Y() - height - this->Padding);
}
}
......
......@@ -74,7 +74,7 @@ vtkPlot::~vtkPlot()
}
//-----------------------------------------------------------------------------
bool vtkPlot::PaintLegend(vtkContext2D*, float*, int )
bool vtkPlot::PaintLegend(vtkContext2D*, const vtkRectf&, int)
{
return false;
}
......
......@@ -36,6 +36,7 @@ class vtkPen;
class vtkBrush;
class vtkAxis;
class vtkVector2f;
class vtkRectf;
class vtkStringArray;
class VTK_CHARTS_EXPORT vtkPlot : public vtkContextItem
......@@ -50,7 +51,7 @@ public:
// corner of the rect (elements 0 and 1) and with width x height (elements 2
// and 3). The plot can choose how to fill the space supplied. The index is used
// by Plots that return more than one label.
virtual bool PaintLegend(vtkContext2D *painter, float rect[4],
virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
int legendIndex);
//BTX
......
......@@ -369,7 +369,7 @@ bool vtkPlotBar::Paint(vtkContext2D *painter)
}
//-----------------------------------------------------------------------------
bool vtkPlotBar::PaintLegend(vtkContext2D *painter, float rect[4],
bool vtkPlotBar::PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
int legendIndex)
{
if (this->ColorSeries)
......
......@@ -52,7 +52,8 @@ public:
// plot items symbol/mark/line drawn. A rect is supplied with the lower left
// corner of the rect (elements 0 and 1) and with width x height (elements 2
// and 3). The plot can choose how to fill the space supplied.
virtual bool PaintLegend(vtkContext2D *painter, float rect[4], int legendIndex);
virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
int legendIndex);
// Description:
// Set the plot color
......
......@@ -17,6 +17,7 @@
#include "vtkContext2D.h"
#include "vtkPen.h"
#include "vtkVector.h"
#include "vtkObjectFactory.h"
......@@ -53,7 +54,7 @@ bool vtkPlotLine::Paint(vtkContext2D *painter)
}
//-----------------------------------------------------------------------------
bool vtkPlotLine::PaintLegend(vtkContext2D *painter, float rect[4], int )
bool vtkPlotLine::PaintLegend(vtkContext2D *painter, const vtkRectf& rect, int)
{
painter->ApplyPen(this->Pen);
painter->DrawLine(rect[0], rect[1]+0.5*rect[3],
......
......@@ -43,7 +43,8 @@ public:
// plot items symbol/mark/line drawn. A rect is supplied with the lower left
// corner of the rect (elements 0 and 1) and with width x height (elements 2
// and 3). The plot can choose how to fill the space supplied.
virtual bool PaintLegend(vtkContext2D *painter, float rect[4], int legendIndex);
virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
int legendIndex);
//BTX
protected:
......
......@@ -201,11 +201,12 @@ bool vtkPlotParallelCoordinates::Paint(vtkContext2D *painter)
}
//-----------------------------------------------------------------------------
bool vtkPlotParallelCoordinates::PaintLegend(vtkContext2D *painter, float rect[4], int )
bool vtkPlotParallelCoordinates::PaintLegend(vtkContext2D *painter,
const vtkRectf& rect, int)
{
painter->ApplyPen(this->Pen);
painter->DrawLine(rect[0], rect[1]+0.5*rect[3],
rect[0]+rect[2], rect[1]+0.5*rect[3]);
painter->DrawLine(rect[0] , rect[1] + 0.5 * rect[3],
rect[0] + rect[2], rect[1] + 0.5 * rect[3]);
return true;
}
......
......@@ -56,7 +56,8 @@ public:
// plot items symbol/mark/line drawn. A rect is supplied with the lower left
// corner of the rect (elements 0 and 1) and with width x height (elements 2
// and 3). The plot can choose how to fill the space supplied.
virtual bool PaintLegend(vtkContext2D *painter, float rect[4], int legendIndex);
virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
int legendIndex);
// Description:
// Get the bounds for this mapper as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
......
......@@ -141,7 +141,8 @@ bool vtkPlotPie::Paint(vtkContext2D *painter)
//-----------------------------------------------------------------------------
bool vtkPlotPie::PaintLegend(vtkContext2D *painter, float rect[4],int legendIndex)
bool vtkPlotPie::PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
int legendIndex)
{
if (this->ColorSeries)
this->Brush
......
......@@ -46,7 +46,7 @@ public:
// plot items symbol/mark/line drawn. A rect is supplied with the lower left
// corner of the rect (elements 0 and 1) and with width x height (elements 2
// and 3). The plot can choose how to fill the space supplied.
bool PaintLegend(vtkContext2D *painter, float rect[4],int legendIndex);
bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect, int legendIndex);
// Description:
// Set the dimensions of the pie, arguments 1 and 2 are the x and y coordinate
......
......@@ -190,7 +190,8 @@ bool vtkPlotPoints::Paint(vtkContext2D *painter)
}
//-----------------------------------------------------------------------------
bool vtkPlotPoints::PaintLegend(vtkContext2D *painter, float rect[4], int )
bool vtkPlotPoints::PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
int)
{
if (this->MarkerStyle)
{
......
......@@ -64,7 +64,8 @@ public:
// plot items symbol/mark/line drawn. A rect is supplied with the lower left
// corner of the rect (elements 0 and 1) and with width x height (elements 2
// and 3). The plot can choose how to fill the space supplied.
virtual bool PaintLegend(vtkContext2D *painter, float rect[4], int legendIndex);
virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
int legendIndex);
// Description:
// Get the bounds for this plot as (Xmin, Xmax, Ymin, Ymax).
......
......@@ -685,7 +685,8 @@ bool vtkPlotStacked::Paint(vtkContext2D *painter)
}
//-----------------------------------------------------------------------------
bool vtkPlotStacked::PaintLegend(vtkContext2D *painter, float rect[4], int )
bool vtkPlotStacked::PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
int)
{
painter->ApplyPen(this->Pen);
painter->ApplyBrush(this->Brush);
......
......@@ -66,7 +66,8 @@ public:
// plot items symbol/mark/line drawn. A rect is supplied with the lower left
// corner of the rect (elements 0 and 1) and with width x height (elements 2
// and 3). The plot can choose how to fill the space supplied.
virtual bool PaintLegend(vtkContext2D *painter, float rect[4], int legendIndex);
virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
int legendIndex);
// Description:
// Get the bounds for this mapper as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
......
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