[vtkusers] How to specify displayed label values of vtkCubeAxesActor

Gerrick Bivins gbivins at objectreservoir.com
Thu Sep 11 12:06:53 EDT 2008


I went ahead an made the changes to address this so here is the patch in
case someone else may find it useful.
I needed to use it because I have to transform my original dataset (only
need) but I want the axis to display the original values.

It adds the following API to vtkCubeAxesActor to allow the user to specify
their own label range for each axis and places them on the associated ticks:
public:
>   
>   //Description:
>   // Set the label range for vtkAxisActor for the X Axis
>   void SetXAxisLabelRange(double minValue, double maxValue);
>   //Description:
>   // Set the label range for vtkAxisActor for the Y Axis
>   void SetYAxisLabelRange(double minValue, double maxValue);
>   //Description:
>   // Set the label range for vtkAxisActor for the Z Axis
>   void SetZAxisLabelRange(double minValue, double maxValue);
>   
>   // Description:
>   // Set/Get whether the XAxis Label ranges are overridden.
>   vtkGetMacro(UseAxisRangeForXLabels, int);
>   vtkSetMacro(UseAxisRangeForXLabels, int);
>   vtkBooleanMacro(UseAxisRangeForXLabels, int);
>   
>   // Description:
>   // Set/Get whether the YAxis Label ranges are overridden.
>   vtkGetMacro(UseAxisRangeForYLabels, int);
>   vtkSetMacro(UseAxisRangeForYLabels, int);
>   vtkBooleanMacro(UseAxisRangeForYLabels, int);
>   
>   // Description:
>   // Set/Get whether the ZAxis Label ranges are overridden.
>   vtkGetMacro(UseAxisRangeForZLabels, int);
>   vtkSetMacro(UseAxisRangeForZLabels, int);
>   vtkBooleanMacro(UseAxisRangeForZLabels, int);

private:
>void ComputeLabelValuesForSpecifiedRange(double inRange[2],
>                                            double& majorStartValue,
>                                            double& majorDelta,
>                                            double& minorStartValue,
>                                            double& minorDelta);


And the following members:

>   int UseAxisRangeForXLabels;
>   int UseAxisRangeForYLabels;
>   int UseAxisRangeForZLabels;
>   
>   double UserXLabelRange[2];
>   double UserYLabelRange[2];
>   double UserZLabelRange[2];

I've tested on the 5.2 release on Mac OSX 10.5.4, Win32 XP and Win64 XP.
Gerrick

On 9/10/08 1:12 PM, "Gerrick Bivins" <gbivins at objectreservoir.com> wrote:

> 
> Hello,
> Is there a way to specify the range of values to display along each axis of
> the vtkCubeAxesActor? From quickly looking at the source code, it looks
> tightly coupled with the bounds of the data it is tied to but I would like
> to be able to specify these ranges separately. Is this possible to do w/o
> making mods to VTK?
> Gerrick

-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkCubeAxesActor.h.txt
Type: application/octet-stream
Size: 2672 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080911/35b47279/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkCubeAxesActor.cxx.txt
Type: application/octet-stream
Size: 9759 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080911/35b47279/attachment-0001.obj>


More information about the vtkusers mailing list