Hybrid/vtkCubeAxesActor.cxx
void vtkCubeAxesActor::AdjustValues(const double xRange[2],
                                    const double yRange[2],
                                    const double zRange[2])
{
  char xTitle[64];

  int xPow, yPow, zPow;

  if (AutoLabelScaling)
    {
    xPow = this->LabelExponent(xRange[0], xRange[1]);
    yPow = this->LabelExponent(yRange[0], yRange[1]);
    zPow = this->LabelExponent(zRange[0], zRange[1]);
    }
  else
    {
    xPow = UserXPow;
    yPow = UserYPow;
    zPow = UserZPow;
    }

  if (xPow != 0)
    {
    if (!this->MustAdjustXValue || this->LastXPow != xPow)
      {
      this->ForceXLabelReset = true;
      }
    else
      {
      this->ForceXLabelReset = false;
      }
    this->MustAdjustXValue = true;

    if (XUnits == NULL || XUnits[0] == '\0')
      {
      sprintf(xTitle, "%s (x10^%d)", this->XTitle, xPow);
      }
    else
      {
      sprintf(xTitle, "%s (x10^%d %s)", this->XTitle, xPow, XUnits);
      }
    }
  else
    {
    if (this->MustAdjustXValue)
      {
      this->Modified();
      this->ForceXLabelReset = true;
      }
    else
      {
      this->ForceXLabelReset = false;
      }
    this->MustAdjustXValue = false;

    if (XUnits == NULL || XUnits[0] == '\0')
      {
      sprintf(xTitle,"%s",this->XTitle);
      }
    else
      {
      sprintf(xTitle, "%s (%s)", this->XTitle, XUnits);
      }
    }

  char yTitle[64];
  if (yPow != 0)
    {
    if (!this->MustAdjustYValue || this->LastYPow != yPow)
      {
      this->ForceYLabelReset = true;
      }
    else
      {
      this->ForceYLabelReset = false;
      }
    this->MustAdjustYValue = true;
    if (YUnits == NULL || YUnits[0] == '\0')
      {
      sprintf(yTitle, "%s (x10^%d)", this->YTitle, yPow);
      }
    else
      {
      sprintf(yTitle, "%s (x10^%d %s)", this->YTitle, yPow, YUnits);
      }
    }
  else
    {
    if (this->MustAdjustYValue)
      {
      this->Modified();
      this->ForceYLabelReset = true;
      }
    else
      {
      this->ForceYLabelReset = false;
      }
    this->MustAdjustYValue = false;
    if (YUnits == NULL || YUnits[0] == '\0')
      {
      sprintf(yTitle,"%s",this->YTitle);
      }
    else
      {
      sprintf(yTitle, "%s (%s)", this->YTitle, YUnits);
      }
    }

  char zTitle[64];
  if (zPow != 0)
    {
    if (!this->MustAdjustZValue || this->LastZPow != zPow)
      {
      this->ForceZLabelReset = true;
      }
    else
      {
      this->ForceZLabelReset = false;
      }
    this->MustAdjustZValue = true;

    if (ZUnits == NULL || ZUnits[0] == '\0')
      {
      sprintf(zTitle, "%s (x10^%d)", this->ZTitle, zPow);
      }
    else
      {
      sprintf(zTitle, "%s (x10^%d %s)", this->ZTitle, zPow, ZUnits);
      }
    }
  else
    {
    if (this->MustAdjustZValue)
      {
      this->Modified();
      this->ForceZLabelReset = true;
      }
    else
      {
      this->ForceZLabelReset = false;
      }
    this->MustAdjustZValue = false;

    if (ZUnits == NULL || ZUnits[0] == '\0')
      {
      sprintf(zTitle,"%s",this->ZTitle);
      }
    else
      {
      sprintf(zTitle, "%s (%s)", this->ZTitle, ZUnits);
      }
    }

  this->LastXPow = xPow;
  this->LastYPow = yPow;
  this->LastZPow = zPow;

  this->SetActualXLabel(xTitle);
  this->SetActualYLabel(yTitle);
  this->SetActualZLabel(zTitle);
}
// ****************************************************************************
//  Method: vtkCubeAxesActor::AdjustValues
//
//  Purpose:
//      If the range of values is too big or too small, put them in scientific
//      notation and changes the labels.
//
//  Arguments:
//      bnds     The min/max values in each coordinate direction:
//                 (min_x, max_x, min_y, max_y, min_z, max_x).
//
//  Note:       This code is partially stolen from old MeshTV code,
//              /meshtvx/toolkit/plotgrid.c, axlab[x|y].
//
//  Programmer: Hank Childs
//  Creation:   July 11, 2000
//
//  Modifications:
//    Kathleen Bonnell, Wed Oct 31 07:57:49 PST 2001
//    Regardless of individual ranges, if any coord direction has too
//    small/large a range, all will have a scale factor set for scaling their
//    label values, and their titles adjusted accordingly.
//
//    Kathleen Bonnell, Thu Sep  5 17:32:16 PDT 2002
//    Only use dimensions with range > 0 for determining scale factor.
//
//    Hank Childs, Fri Sep 27 17:15:07 PDT 2002
//    Account for units.
//
//    Kathleen Bonnell, Wed Aug  6 13:59:15 PDT 2003
//    Each axis type now has its own 'mustAdjustValue' and 'lastPow'.
//
//    Kathleen Bonnell, Tue Dec 16 11:23:31 PST 2003
//    Allow the LabelExponent to be user-settable (autLabelScaling is off).
//    For title use '10e' instead of just 'e' to designate that exponent
//    has been used.
//
//    Kathleen Bonnell, Tue Jul 20 11:41:45 PDT 2004
//    For title use 'x10^' instead of '10e' to designate that exponent.
//
//    Brad Whitlock, Fri Jul 23 18:27:30 PST 2004
//    Added support for using user-defined titles for axes.
//
// ****************************************************************************
:AdjustValues
Purpose:
If the range of values is too big or too small, put them in scientific
notation and changes the labels.



This code is partially stolen from old MeshTV code,
meshtvx/toolkit/plotgrid.c, axlab[x|y].

Hank Childs
Creation:   July 11, 2000

Kathleen Bonnell, Wed Oct 31 07:57:49 PST 2001
Regardless of individual ranges, if any coord direction has too
small/large a range, all will have a scale factor set for scaling their
label values, and their titles adjusted accordingly.

Kathleen Bonnell, Thu Sep  5 17:32:16 PDT 2002
Only use dimensions with range > 0 for determining scale factor.

Hank Childs, Fri Sep 27 17:15:07 PDT 2002
Account for units.

Kathleen Bonnell, Wed Aug  6 13:59:15 PDT 2003
Each axis type now has its own 'mustAdjustValue' and 'lastPow'.

Kathleen Bonnell, Tue Dec 16 11:23:31 PST 2003
Allow the LabelExponent to be user-settable (autLabelScaling is off).
For title use '10e' instead of just 'e' to designate that exponent
has been used.

Kathleen Bonnell, Tue Jul 20 11:41:45 PDT 2004
For title use 'x10^' instead of '10e' to designate that exponent.

Brad Whitlock, Fri Jul 23 18:27:30 PST 2004
Added support for using user-defined titles for axes.
: AdjustValues Purpose : If the range of values is too big or too small put them in scientific notation and changes the labels . This code is partially stolen from old MeshTV code meshtvx / toolkit / plotgrid . c axlab [ x|y ] . Hank Childs Creation : July 11 2000 Kathleen Bonnell Wed Oct 31 07 : 57 : 49 PST 2001 Regardless of individual ranges if any coord direction has too small / large a range all will have a scale factor set for scaling their label values and their titles adjusted accordingly . Kathleen Bonnell Thu Sep 5 17 : 32 : 16 PDT 2002 Only use dimensions with range > 0 for determining scale factor . Hank Childs Fri Sep 27 17 : 15 : 07 PDT 2002 Account for units . Kathleen Bonnell Wed Aug 6 13 : 59 : 15 PDT 2003 Each axis type now has its own ' mustAdjustValue ' and ' lastPow ' . Kathleen Bonnell Tue Dec 16 11 : 23 : 31 PST 2003 Allow the LabelExponent to be user - settable ( autLabelScaling is off ) . For title use ' 10e ' instead of just ' e ' to designate that exponent has been used . Kathleen Bonnell Tue Jul 20 11 : 41 : 45 PDT 2004 For title use ' x10^ ' instead of ' 10e ' to designate that exponent . Brad Whitlock Fri Jul 23 18 : 27 : 30 PST 2004 Added support for using user - defined titles for axes .
void vtkCubeAxesActor::AdjustValues(const double xRange[2],
                                    const double yRange[2],
                                    const double zRange[2])
{
  char xTitle[64];
  int xPow, yPow, zPow;
  if (AutoLabelScaling)
    {
    xPow = this->LabelExponent(xRange[0], xRange[1]);
    yPow = this->LabelExponent(yRange[0], yRange[1]);
    zPow = this->LabelExponent(zRange[0], zRange[1]);
    }
  else
    {
    xPow = UserXPow;
    yPow = UserYPow;
    zPow = UserZPow;
    }
  if (xPow != 0)
    {
    if (!this->MustAdjustXValue || this->LastXPow != xPow)
      {
      this->ForceXLabelReset = true;
      }
    else
      {
      this->ForceXLabelReset = false;
      }
    this->MustAdjustXValue = true;
    if (XUnits == NULL || XUnits[0] == '\0')
      {
      sprintf(xTitle, "%s (x10^%d)", this->XTitle, xPow);
      }
    else
      {
      sprintf(xTitle, "%s (x10^%d %s)", this->XTitle, xPow, XUnits);
      }
    }
  else
    {
    if (this->MustAdjustXValue)
      {
      this->Modified();
      this->ForceXLabelReset = true;
      }
    else
      {
      this->ForceXLabelReset = false;
      }
    this->MustAdjustXValue = false;
    if (XUnits == NULL || XUnits[0] == '\0')
      {
      sprintf(xTitle,"%s",this->XTitle);
      }
    else
      {
      sprintf(xTitle, "%s (%s)", this->XTitle, XUnits);
      }
    }
  char yTitle[64];
  if (yPow != 0)
    {
    if (!this->MustAdjustYValue || this->LastYPow != yPow)
      {
      this->ForceYLabelReset = true;
      }
    else
      {
      this->ForceYLabelReset = false;
      }
    this->MustAdjustYValue = true;
    if (YUnits == NULL || YUnits[0] == '\0')
      {
      sprintf(yTitle, "%s (x10^%d)", this->YTitle, yPow);
      }
    else
      {
      sprintf(yTitle, "%s (x10^%d %s)", this->YTitle, yPow, YUnits);
      }
    }
  else
    {
    if (this->MustAdjustYValue)
      {
      this->Modified();
      this->ForceYLabelReset = true;
      }
    else
      {
      this->ForceYLabelReset = false;
      }
    this->MustAdjustYValue = false;
    if (YUnits == NULL || YUnits[0] == '\0')
      {
      sprintf(yTitle,"%s",this->YTitle);
      }
    else
      {
      sprintf(yTitle, "%s (%s)", this->YTitle, YUnits);
      }
    }
  char zTitle[64];
  if (zPow != 0)
    {
    if (!this->MustAdjustZValue || this->LastZPow != zPow)
      {
      this->ForceZLabelReset = true;
      }
    else
      {
      this->ForceZLabelReset = false;
      }
    this->MustAdjustZValue = true;
    if (ZUnits == NULL || ZUnits[0] == '\0')
      {
      sprintf(zTitle, "%s (x10^%d)", this->ZTitle, zPow);
      }
    else
      {
      sprintf(zTitle, "%s (x10^%d %s)", this->ZTitle, zPow, ZUnits);
      }
    }
  else
    {
    if (this->MustAdjustZValue)
      {
      this->Modified();
      this->ForceZLabelReset = true;
      }
    else
      {
      this->ForceZLabelReset = false;
      }
    this->MustAdjustZValue = false;
    if (ZUnits == NULL || ZUnits[0] == '\0')
      {
      sprintf(zTitle,"%s",this->ZTitle);
      }
    else
      {
      sprintf(zTitle, "%s (%s)", this->ZTitle, ZUnits);
      }
    }
  this->LastXPow = xPow;
  this->LastYPow = yPow;
  this->LastZPow = zPow;
  this->SetActualXLabel(xTitle);
  this->SetActualYLabel(yTitle);
  this->SetActualZLabel(zTitle);
}
void vtkCubeAxesActor :: AdjustValues ( const double xRange [ 2 ] , const double yRange [ 2 ] , const double zRange [ 2 ] ) { char xTitle [ 64 ] ; int xPow , yPow , zPow ; if ( AutoLabelScaling ) { xPow = this -> LabelExponent ( xRange [ 0 ] , xRange [ 1 ] ) ; yPow = this -> LabelExponent ( yRange [ 0 ] , yRange [ 1 ] ) ; zPow = this -> LabelExponent ( zRange [ 0 ] , zRange [ 1 ] ) ; } else { xPow = UserXPow ; yPow = UserYPow ; zPow = UserZPow ; } if ( xPow != 0 ) { if ( ! this -> MustAdjustXValue || this -> LastXPow != xPow ) { this -> ForceXLabelReset = true ; } else { this -> ForceXLabelReset = false ; } this -> MustAdjustXValue = true ; if ( XUnits == NULL || XUnits [ 0 ] == ' \0 ' ) { sprintf ( xTitle , " " , this -> XTitle , xPow ) ; } else { sprintf ( xTitle , " " , this -> XTitle , xPow , XUnits ) ; } } else { if ( this -> MustAdjustXValue ) { this -> Modified ( ) ; this -> ForceXLabelReset = true ; } else { this -> ForceXLabelReset = false ; } this -> MustAdjustXValue = false ; if ( XUnits == NULL || XUnits [ 0 ] == ' \0 ' ) { sprintf ( xTitle , " " , this -> XTitle ) ; } else { sprintf ( xTitle , " " , this -> XTitle , XUnits ) ; } } char yTitle [ 64 ] ; if ( yPow != 0 ) { if ( ! this -> MustAdjustYValue || this -> LastYPow != yPow ) { this -> ForceYLabelReset = true ; } else { this -> ForceYLabelReset = false ; } this -> MustAdjustYValue = true ; if ( YUnits == NULL || YUnits [ 0 ] == ' \0 ' ) { sprintf ( yTitle , " " , this -> YTitle , yPow ) ; } else { sprintf ( yTitle , " " , this -> YTitle , yPow , YUnits ) ; } } else { if ( this -> MustAdjustYValue ) { this -> Modified ( ) ; this -> ForceYLabelReset = true ; } else { this -> ForceYLabelReset = false ; } this -> MustAdjustYValue = false ; if ( YUnits == NULL || YUnits [ 0 ] == ' \0 ' ) { sprintf ( yTitle , " " , this -> YTitle ) ; } else { sprintf ( yTitle , " " , this -> YTitle , YUnits ) ; } } char zTitle [ 64 ] ; if ( zPow != 0 ) { if ( ! this -> MustAdjustZValue || this -> LastZPow != zPow ) { this -> ForceZLabelReset = true ; } else { this -> ForceZLabelReset = false ; } this -> MustAdjustZValue = true ; if ( ZUnits == NULL || ZUnits [ 0 ] == ' \0 ' ) { sprintf ( zTitle , " " , this -> ZTitle , zPow ) ; } else { sprintf ( zTitle , " " , this -> ZTitle , zPow , ZUnits ) ; } } else { if ( this -> MustAdjustZValue ) { this -> Modified ( ) ; this -> ForceZLabelReset = true ; } else { this -> ForceZLabelReset = false ; } this -> MustAdjustZValue = false ; if ( ZUnits == NULL || ZUnits [ 0 ] == ' \0 ' ) { sprintf ( zTitle , " " , this -> ZTitle ) ; } else { sprintf ( zTitle , " " , this -> ZTitle , ZUnits ) ; } } this -> LastXPow = xPow ; this -> LastYPow = yPow ; this -> LastZPow = zPow ; this -> SetActualXLabel ( xTitle ) ; this -> SetActualYLabel ( yTitle ) ; this -> SetActualZLabel ( zTitle ) ; }
Method: vtkCubeAxesActor::AdjustValues
Purpose:
If the range of values is too big or too small, put them in scientific
notation and changes the labels.
Method : vtkCubeAxesActor :: AdjustValues Purpose : If the range of values is too big or too small put them in scientific notation and changes the labels .