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

Method PrepareTitleText

Rendering/Annotation/vtkScalarBarActor.cxx:1097–1128  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1095
1096//------------------------------------------------------------------------------
1097void vtkScalarBarActor::PrepareTitleText()
1098{
1099 // Update actor with the latest title/subtitle
1100 if (this->ComponentTitle && strlen(this->ComponentTitle) > 0)
1101 {
1102 // need to account for a space between title & component and null term
1103 char* combinedTitle = new char[strlen(this->Title) + strlen(this->ComponentTitle) + 2];
1104 strcpy(combinedTitle, this->Title);
1105 strcat(combinedTitle, " ");
1106 strcat(combinedTitle, this->ComponentTitle);
1107 this->TitleActor->SetInput(combinedTitle);
1108 delete[] combinedTitle;
1109 }
1110 else
1111 {
1112 this->TitleActor->SetInput(this->Title);
1113 }
1114
1115 if (this->TitleTextProperty->GetMTime() > this->BuildTime)
1116 {
1117 // Shallow copy here so that the size of the title prop is not affected
1118 // by the automatic adjustment of its text mapper's size (i.e. its
1119 // mapper's text property is identical except for the font size
1120 // which will be modified later). This allows text actors to
1121 // share the same text property, and in that case specifically allows
1122 // the title and label text prop to be the same.
1123 this->TitleActor->GetTextProperty()->ShallowCopy(this->TitleTextProperty);
1124 this->TitleActor->GetTextProperty()->SetJustificationToCentered();
1125 this->TitleActor->GetTextProperty()->SetVerticalJustification(
1126 this->TextPosition == PrecedeScalarBar ? VTK_TEXT_BOTTOM : VTK_TEXT_TOP);
1127 }
1128}
1129
1130//------------------------------------------------------------------------------
1131void vtkScalarBarActor::LayoutTitle()

Callers 1

RebuildLayoutMethod · 0.95

Calls 4

SetInputMethod · 0.45
GetMTimeMethod · 0.45
ShallowCopyMethod · 0.45
GetTextPropertyMethod · 0.45

Tested by

no test coverage detected