18 #include "vtkUnicodeString.h"
19 #include <vtkPropAssembly.h>
20 #include <vtkTextActor.h>
21 #include <vtkTextProperty.h>
26 position[0] = position[1] = 0;
44 LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
50 bounds.
Size[0] = size[0];
51 bounds.
Size[1] = size[1];
57 LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
62 posS[0] = posT[0] + 1;
63 posS[1] = posT[1] - 1;
65 ls->
m_TextActor->SetDisplayPosition(posT[0], posT[1]);
79 m_TextActor->SetTextProperty(m_TextProp);
80 m_STextActor->SetTextProperty(m_STextProp);
82 m_Assembly->AddPart(m_STextActor);
83 m_Assembly->AddPart(m_TextActor);
88 LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
92 float color[3] = {0.0, 1.0, 0.0};
94 GetColor(color, renderer);
95 GetOpacity(opacity, renderer);
96 ls->
m_TextProp->SetColor(color[0], color[1], color[2]);
103 std::string fontFamilyAsString;
104 if (GetStringProperty(
"font.family", fontFamilyAsString) ==
false)
106 fontFamilyAsString =
"Arial";
108 ls->
m_TextProp->SetFontFamilyAsString(fontFamilyAsString.c_str());
109 ls->
m_STextProp->SetFontFamilyAsString(fontFamilyAsString.c_str());
111 bool boldFont(
false);
112 GetBoolProperty(
"font.bold", boldFont);
116 bool italicFont(
false);
117 GetBoolProperty(
"font.italic", italicFont);
122 GetBoolProperty(
"drawShadow", drawShadow);
131 posT[0] = GetPosition2D(renderer)[0] + GetOffsetVector(renderer)[0];
132 posT[1] = GetPosition2D(renderer)[1] + GetOffsetVector(renderer)[1];
133 posS[0] = posT[0] + 1;
134 posS[1] = posT[1] - 1;
136 ls->
m_TextActor->SetDisplayPosition(posT[0], posT[1]);
144 LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
150 LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
TextOverlay2D()
explicit constructor which disallows implicit conversions
LocalStorage()
Default constructor of the local storage.
itk::Point< double, 2 > Size
Organizes the rendering process.
vtkSmartPointer< vtkTextProperty > m_TextProp
itk::Point< double, 2 > Position
void SetColor(const mitk::Color &color, mitk::BaseRenderer *renderer=nullptr, const std::string &propertyKey="color")
Convenience method for setting color properties (instances of ColorProperty)
void SetOffsetVector(const Point2D &OffsetVector, BaseRenderer *renderer=NULL)
virtual vtkActor2D * GetVtkActor2D(BaseRenderer *renderer) const override
virtual ~TextOverlay2D()
virtual destructor in order to derive from this class
vtkSmartPointer< vtkTextActor > m_STextActor
vtkSmartPointer< vtkPropAssembly > m_Assembly
void SetFontSize(int fontSize, mitk::BaseRenderer *renderer=nullptr)
vtkSmartPointer< vtkTextProperty > m_STextProp
virtual void SetBoundsOnDisplay(BaseRenderer *renderer, const Bounds &bounds) override
Sets position and size of the overlay on the display.
void SetBoolProperty(const std::string &propertyKey, bool boolValue, mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting int properties (instances of IntProperty)
void UpdateGenerateDataTime()
~LocalStorage()
Default deconstructor of the local storage.
virtual Overlay::Bounds GetBoundsOnDisplay(BaseRenderer *renderer) const override
Returns position and size of the overlay on the display.
void SetPosition2D(const Point2D &position2D, mitk::BaseRenderer *renderer=NULL)
bool IsGenerateDataRequired(mitk::BaseRenderer *renderer, mitk::Overlay *overlay)
void SetText(std::string text, mitk::BaseRenderer *renderer=nullptr)
vtkRenderer * GetVtkRenderer() const
vtkProp * GetVtkProp(BaseRenderer *renderer) const override
This method is implemented by the specific VTKOverlays in order to create the element as a vtkProp...
void UpdateVtkOverlay2D(mitk::BaseRenderer *renderer) override
void SetStringProperty(const std::string &propertyKey, const std::string &string, mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting int properties (instances of IntProperty)
Container for position and size on the display.
vtkSmartPointer< vtkTextActor > m_TextActor
Actor of a 2D render window.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.