MCPcopy Create free account
hub / github.com/MITK/MITK / UpdateVtkAnnotation2D

Method UpdateVtkAnnotation2D

Modules/Annotation/src/mitkTextAnnotation2D.cpp:82–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82void mitk::TextAnnotation2D::UpdateVtkAnnotation2D(mitk::BaseRenderer *renderer)
83{
84 LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
85
86 if (ls->IsGenerateDataRequired(renderer, this))
87 {
88 float color[3] = {0.0, 1.0, 0.0};
89 float opacity = 1.0;
90 GetColor(color);
91 GetOpacity(opacity);
92 ls->m_TextProp->SetColor(color[0], color[1], color[2]);
93 ls->m_STextProp->SetColor(0, 0, 0);
94 ls->m_TextProp->SetFontSize(GetFontSize());
95 ls->m_TextProp->SetOpacity(opacity);
96 ls->m_STextProp->SetFontSize(GetFontSize());
97 ls->m_STextProp->SetOpacity(opacity);
98
99 std::string fontFamilyAsString;
100 if (GetStringProperty("font.family", fontFamilyAsString) == false)
101 {
102 fontFamilyAsString = "Arial";
103 }
104 ls->m_TextProp->SetFontFamilyAsString(fontFamilyAsString.c_str());
105 ls->m_STextProp->SetFontFamilyAsString(fontFamilyAsString.c_str());
106
107 bool boldFont(false);
108 GetBoolProperty("font.bold", boldFont);
109 ls->m_TextProp->SetBold(boldFont);
110 ls->m_STextProp->SetBold(boldFont);
111
112 bool italicFont(false);
113 GetBoolProperty("font.italic", italicFont);
114 ls->m_TextProp->SetBold(italicFont);
115 ls->m_STextProp->SetBold(italicFont);
116
117 bool drawShadow;
118 GetBoolProperty("drawShadow", drawShadow);
119 ls->m_TextProp->SetShadow(false);
120 ls->m_STextProp->SetShadow(false);
121 ls->m_STextActor->SetVisibility(drawShadow);
122
123 ls->m_TextActor->SetInput(GetText().c_str());
124 ls->m_STextActor->SetInput(GetText().c_str());
125
126 mitk::Point2D posT, posS;
127 posT[0] = GetPosition2D()[0] + GetOffsetVector()[0];
128 posT[1] = GetPosition2D()[1] + GetOffsetVector()[1];
129 posS[0] = posT[0] + 1;
130 posS[1] = posT[1] - 1;
131
132 ls->m_TextActor->SetDisplayPosition(posT[0], posT[1]);
133 ls->m_STextActor->SetDisplayPosition(posS[0], posS[1]);
134 ls->UpdateGenerateDataTime();
135 }
136}
137
138vtkProp *mitk::TextAnnotation2D::GetVtkProp(mitk::BaseRenderer *renderer) const
139{

Callers

nothing calls this directly

Calls 7

GetLocalStorageMethod · 0.45
SetColorMethod · 0.45
SetFontSizeMethod · 0.45
SetOpacityMethod · 0.45
SetVisibilityMethod · 0.45
SetInputMethod · 0.45

Tested by

no test coverage detected