------------------------------------------------------------------------------ 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 Me
| 777 | // Note: This code is partially stolen from old MeshTV code, |
| 778 | // /meshtvx/toolkit/plotgrid.c, axlab[x|y]. |
| 779 | void vtkCubeAxesActor::AdjustValues( |
| 780 | const double xRange[2], const double yRange[2], const double zRange[2]) |
| 781 | { |
| 782 | int xPow, yPow, zPow; |
| 783 | |
| 784 | if (AutoLabelScaling) |
| 785 | { |
| 786 | if (this->AxisLabels[0] == nullptr) |
| 787 | { |
| 788 | xPow = this->LabelExponent(xRange[0], xRange[1]); |
| 789 | } |
| 790 | else |
| 791 | { |
| 792 | xPow = 0; |
| 793 | } |
| 794 | if (this->AxisLabels[1] == nullptr) |
| 795 | { |
| 796 | yPow = this->LabelExponent(yRange[0], yRange[1]); |
| 797 | } |
| 798 | else |
| 799 | { |
| 800 | yPow = 0; |
| 801 | } |
| 802 | if (this->AxisLabels[2] == nullptr) |
| 803 | { |
| 804 | zPow = this->LabelExponent(zRange[0], zRange[1]); |
| 805 | } |
| 806 | else |
| 807 | { |
| 808 | zPow = 0; |
| 809 | } |
| 810 | } |
| 811 | else |
| 812 | { |
| 813 | xPow = UserXPow; |
| 814 | yPow = UserYPow; |
| 815 | zPow = UserZPow; |
| 816 | } |
| 817 | |
| 818 | std::string xTitle; |
| 819 | if (xPow != 0) |
| 820 | { |
| 821 | this->ForceXLabelReset = !this->MustAdjustXValue || this->LastXPow != xPow; |
| 822 | this->MustAdjustXValue = true; |
| 823 | |
| 824 | std::ostringstream sstream; |
| 825 | if (XUnits == nullptr || XUnits[0] == '\0') |
| 826 | { |
| 827 | sstream << this->XTitle << " (x10^" << xPow << ")"; |
| 828 | } |
| 829 | else |
| 830 | { |
| 831 | sstream << this->XTitle << " (x10^" << xPow << " " << XUnits << ")"; |
| 832 | } |
| 833 | xTitle = sstream.str(); |
| 834 | } |
| 835 | else |
| 836 | { |