Skip to content
Snippets Groups Projects
Commit 94d03e0b authored by David Lonie's avatar David Lonie Committed by Kitware Robot
Browse files

Merge topic 'pv16927-billboard-display-offset'


a279244d Add a display-coordinate offset to billboard text.

Acked-by: default avatarKitware Robot <kwrobot@kitware.com>
Acked-by: default avatarT.J. Corona <tj.corona@kitware.com>
Merge-request: !2054
parents d4623bd9 a279244d
Branches
No related tags found
No related merge requests found
......@@ -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<double>(this->DisplayOffset[0]);
anchorDC[1] += static_cast<double>(this->DisplayOffset[1]);
// Cached for OpenGL2 GL2PS exports:
this->AnchorDC[0] = anchorDC[0];
this->AnchorDC[1] = anchorDC[1];
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment