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

Method BuildTitle

Rendering/Annotation/vtkAxisActor2D.cxx:965–1004  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

963
964//------------------------------------------------------------------------------
965void vtkAxisActor2D::BuildTitle(vtkViewport* viewport)
966{
967 this->TitleMapper->SetInput(this->Title);
968
969 if (this->TitleTextProperty->GetMTime() > this->BuildTime)
970 {
971 // Shallow copy here so that the size of the title prop is not
972 // affected by the automatic adjustment of its text mapper's
973 // size (i.e. its mapper's text property is identical except for
974 // the font size which will be modified later). This allows text
975 // actors to share the same text property, and in that case
976 // specifically allows the title and label text prop to be the same.
977 this->TitleMapper->GetTextProperty()->ShallowCopy(this->TitleTextProperty);
978 }
979
980 int stringSize[2];
981 this->SetTitleFontSize(viewport, stringSize);
982
983 int* x1 = this->PositionCoordinate->GetComputedViewportValue(viewport);
984 int* x2 = this->Position2Coordinate->GetComputedViewportValue(viewport);
985 double tickPosition[3];
986 tickPosition[0] = x1[0] + (x2[0] - x1[0]) * this->TitlePosition;
987 tickPosition[1] = x1[1] + (x2[1] - x1[1]) * this->TitlePosition;
988
989 double textOrientation = this->TitleTextProperty->GetOrientation();
990 double theta = vtkMath::RadiansFromDegrees(textOrientation);
991
992 double offset = this->TickLength + this->TickOffset;
993 if (this->LabelVisibility)
994 {
995 offset += vtkAxisActor2D::ComputeStringOffset(
996 this->LastMaxLabelSize[0], this->LastMaxLabelSize[1], theta);
997 }
998
999 int textPos[2];
1000 this->ShiftPosition(
1001 tickPosition, theta, stringSize[0], stringSize[1], static_cast<int>(offset), textPos);
1002
1003 this->TitleActor->SetPosition(textPos[0], textPos[1]);
1004}
1005
1006//------------------------------------------------------------------------------
1007void vtkAxisActor2D::UpdateCachedInformations(vtkViewport* viewport)

Callers 1

BuildAxisMethod · 0.95

Calls 9

SetTitleFontSizeMethod · 0.95
ShiftPositionMethod · 0.95
SetInputMethod · 0.45
GetMTimeMethod · 0.45
ShallowCopyMethod · 0.45
GetTextPropertyMethod · 0.45
GetOrientationMethod · 0.45
SetPositionMethod · 0.45

Tested by

no test coverage detected