MCPcopy Create free account
hub / github.com/Kitware/VTK / AdjustValues

Method AdjustValues

Rendering/Annotation/vtkCubeAxesActor.cxx:779–944  ·  view source on GitHub ↗

------------------------------------------------------------------------------ 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

Source from the content-addressed store, hash-verified

777// Note: This code is partially stolen from old MeshTV code,
778// /meshtvx/toolkit/plotgrid.c, axlab[x|y].
779void 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 {

Callers 1

BuildAxesMethod · 0.95

Calls 5

LabelExponentMethod · 0.95
stringClass · 0.50
strMethod · 0.45
ModifiedMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected