[vtk-developers] vtkXYPlotActor range fix
Patrick D. Emond
patrickdemond at gmail.com
Tue Jun 26 17:59:29 EDT 2007
Hello,
I recently noticed that if vtkXYPlotActor::SetAdjustXLabels( 0 ) is
called the vtkAxisActor2D objects scale smoothly (with no adjustments)
but opaque geometry is still rendered using adjusted ranges. I'd like
to suggest the following fix to this error:
(All I have done is created two ivars in vtkXYPlotActor, AdjustXLabels
and AdjustYLabels, that are checked when computing the range in
RenderOpaqueGeometry())
Index: vtkXYPlotActor.h
===================================================================
RCS file: /cvsroot/VTK/VTK/Hybrid/vtkXYPlotActor.h,v
retrieving revision 1.34
diff -r1.34 vtkXYPlotActor.h
339c339
< int GetAdjustXLabels();
---
> vtkGetMacro( AdjustXLabels, int );
341c341
< int GetAdjustYLabels();
---
> vtkGetMacro( AdjustYLabels, int );
547a548,549
> int AdjustXLabels;
> int AdjustYLabels;
Index: vtkXYPlotActor.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Hybrid/vtkXYPlotActor.cxx,v
retrieving revision 1.67
diff -r1.67 vtkXYPlotActor.cxx
182a183,184
> this->AdjustXLabels = 1;
> this->AdjustYLabels = 1;
637a640,650
>
> if ( this->AdjustXLabels )
> {
> vtkAxisActor2D::ComputeRange(range, xRange, this->NumberOfXLabels,
> numTicks, interval);
> }
> else
> {
> xRange[0] = range[0];
> xRange[1] = range[1];
> }
639,640d651
< vtkAxisActor2D::ComputeRange(range, xRange, this->NumberOfXLabels,
< numTicks, interval);
685,686c696,705
< vtkAxisActor2D::ComputeRange(yrange, yRange, this->NumberOfYLabels,
< numTicks, interval);
---
> if ( this->AdjustYLabels )
> {
> vtkAxisActor2D::ComputeRange(yrange, yRange, this->NumberOfYLabels,
> numTicks, interval);
> }
> else
> {
> yRange[0] = yrange[0];
> yRange[1] = yrange[1];
> }
980a1000,1003
> os << indent << "AdjustXLabels: "
> << this->AdjustXLabels << endl;
> os << indent << "AdjustYLabels: "
> << this->AdjustYLabels << endl;
2228a2252
> this->AdjustXLabels = adjust;
2233,2238d2256
< int vtkXYPlotActor::GetAdjustXLabels()
< {
< return this->XAxis->GetAdjustLabels();
< }
<
<
//----------------------------------------------------------------------------
2240a2259
> this->AdjustYLabels = adjust;
2245,2250d2263
< int vtkXYPlotActor::GetAdjustYLabels()
< {
< return this->YAxis->GetAdjustLabels();
< }
<
<
//----------------------------------------------------------------------------
I've never contributed to VTK before so I wasn't sure how to go about
it. If the above diff output isn't suitable please let me know.
Patrick
More information about the vtk-developers
mailing list