------------------------------------------------------------------------------
| 772 | |
| 773 | //------------------------------------------------------------------------------ |
| 774 | void vtkAxisActor::BuildExponent(bool force) |
| 775 | { |
| 776 | if (!force && (!this->ExponentVisibility || this->Exponent.empty())) |
| 777 | { |
| 778 | return; |
| 779 | } |
| 780 | |
| 781 | if (!force && this->ExponentTextTime.GetMTime() < this->BuildTime.GetMTime() && |
| 782 | this->BoundsTime.GetMTime() < this->BuildTime.GetMTime() && |
| 783 | this->LabelBuildTime.GetMTime() < this->BuildTime.GetMTime()) |
| 784 | { |
| 785 | return; |
| 786 | } |
| 787 | |
| 788 | this->UpdateExponentActorProperty(); |
| 789 | |
| 790 | // ---------- labels size ---------- |
| 791 | // local orientation (in the plane of the label) |
| 792 | double labelAngle = vtkMath::RadiansFromDegrees(this->LabelTextProperty->GetOrientation()); |
| 793 | double labelCos = fabs(cos(labelAngle)), labelSin = fabs(sin(labelAngle)); |
| 794 | double labBounds[6]; |
| 795 | double offset[2] = { 0, this->ExponentOffset }; |
| 796 | |
| 797 | // find max height label (with the label text property considered) |
| 798 | // only when title is on bottom |
| 799 | if (this->LabelVisibility && this->ExponentLocation != VTK_ALIGN_TOP) |
| 800 | { |
| 801 | double labelMaxHeight, labHeight; |
| 802 | labelMaxHeight = labHeight = 0; |
| 803 | for (int i = 0; i < this->NumberOfLabelsBuilt; i++) |
| 804 | { |
| 805 | this->LabelProps[i]->GetBounds(labBounds); |
| 806 | |
| 807 | // labels actor aren't oriented yet, width and height are considered in |
| 808 | // their local coordinate system |
| 809 | // however, LabelTextProperty can orient it, but locally (in its plane) |
| 810 | labHeight = |
| 811 | (labBounds[1] - labBounds[0]) * labelSin + (labBounds[3] - labBounds[2]) * labelCos; |
| 812 | labelMaxHeight = (labHeight > labelMaxHeight ? labHeight : labelMaxHeight); |
| 813 | } |
| 814 | offset[1] += this->LabelOffset + this->ScreenSize * labelMaxHeight; |
| 815 | } |
| 816 | |
| 817 | // ---------- title size ---------- |
| 818 | double titleBounds[6]; |
| 819 | this->TitleProp->GetBounds(titleBounds); |
| 820 | if (this->TitleVisibility && this->TitleAlignLocation == this->ExponentLocation) |
| 821 | { |
| 822 | offset[1] += this->TitleOffset[1] + this->ScreenSize * titleBounds[3] - titleBounds[2]; |
| 823 | } |
| 824 | |
| 825 | // ---------- exponent size ---------- |
| 826 | double exponentBounds[6]; |
| 827 | this->ExponentProp->GetBounds(exponentBounds); |
| 828 | double halfExponentHeight = (exponentBounds[3] - exponentBounds[2]) * 0.5; |
| 829 | double halfExponentWidth = (exponentBounds[1] - exponentBounds[0]) * 0.5; |
| 830 | |
| 831 | double* p1 = this->Point1Coordinate->GetValue(); |
no test coverage detected