diff --git a/Rendering/Core/vtkBillboardTextActor3D.cxx b/Rendering/Core/vtkBillboardTextActor3D.cxx index af64e82d1ef469fcee7220835609cc8fd1bb8ea9..9cff7fdca90b7be5a0cd11ad53dfea03639c786f 100644 --- a/Rendering/Core/vtkBillboardTextActor3D.cxx +++ b/Rendering/Core/vtkBillboardTextActor3D.cxx @@ -210,7 +210,9 @@ void vtkBillboardTextActor3D::PrintSelf(std::ostream &os, vtkIndent indent) << indent << "InputMTime: " << this->InputMTime << "\n" << indent << "TextRenderer: " << this->TextRenderer.Get() << "\n" << indent << "AnchorDC: " << this->AnchorDC[0] << " " << this->AnchorDC[1] - << " " << this->AnchorDC[2] << "\n"; + << " " << this->AnchorDC[2] << "\n" + << indent << "DisplayOffset: " << this->DisplayOffset[0] << " " + << this->DisplayOffset[1] << "\n"; os << indent << "Image:\n"; this->Image->PrintSelf(os, indent.GetNextIndent()); @@ -337,6 +339,7 @@ vtkBillboardTextActor3D::vtkBillboardTextActor3D() RenderedDPI(-1) { std::fill(this->AnchorDC, this->AnchorDC + 3, 0.); + std::fill(this->DisplayOffset, this->DisplayOffset + 2, 0); // Connect internal rendering pipeline: this->Texture->InterpolateOff(); @@ -481,6 +484,10 @@ void vtkBillboardTextActor3D::GenerateQuad(vtkRenderer *ren) anchorDC[0] = std::floor(anchorDC[0]); anchorDC[1] = std::floor(anchorDC[1]); + // Apply the requested offset: + anchorDC[0] += static_cast(this->DisplayOffset[0]); + anchorDC[1] += static_cast(this->DisplayOffset[1]); + // Cached for OpenGL2 GL2PS exports: this->AnchorDC[0] = anchorDC[0]; this->AnchorDC[1] = anchorDC[1]; diff --git a/Rendering/Core/vtkBillboardTextActor3D.h b/Rendering/Core/vtkBillboardTextActor3D.h index 045df355ce502121ed83ff94509d38908001a9b7..f640aa02c4d6d92b2ccbe0be6c32fadfb03ea13d 100644 --- a/Rendering/Core/vtkBillboardTextActor3D.h +++ b/Rendering/Core/vtkBillboardTextActor3D.h @@ -48,6 +48,15 @@ public: vtkGetStringMacro(Input) /** @} */ + /** + * Can be used to set a fixed offset from the anchor point. + * Use display coordinates. + * @{ + */ + vtkGetVector2Macro(DisplayOffset, int) + vtkSetVector2Macro(DisplayOffset, int) + /** @} */ + /** * The vtkTextProperty object that controls the rendered text. * @{ @@ -105,6 +114,9 @@ protected: char *Input; vtkTextProperty *TextProperty; + // Offset in display coordinates. + int DisplayOffset[2]; + // Cached metadata to determine if things need rebuildin' int RenderedDPI; vtkTimeStamp InputMTime;