Commit 94d03e0b authored by David Lonie's avatar David Lonie Committed by Kitware Robot

Merge topic 'pv16927-billboard-display-offset'

a279244d Add a display-coordinate offset to billboard text.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: T.J. Corona's avatarT.J. Corona <tj.corona@kitware.com>
Merge-request: !2054
parents d4623bd9 a279244d
...@@ -210,7 +210,9 @@ void vtkBillboardTextActor3D::PrintSelf(std::ostream &os, vtkIndent indent) ...@@ -210,7 +210,9 @@ void vtkBillboardTextActor3D::PrintSelf(std::ostream &os, vtkIndent indent)
<< indent << "InputMTime: " << this->InputMTime << "\n" << indent << "InputMTime: " << this->InputMTime << "\n"
<< indent << "TextRenderer: " << this->TextRenderer.Get() << "\n" << indent << "TextRenderer: " << this->TextRenderer.Get() << "\n"
<< indent << "AnchorDC: " << this->AnchorDC[0] << " " << this->AnchorDC[1] << 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"; os << indent << "Image:\n";
this->Image->PrintSelf(os, indent.GetNextIndent()); this->Image->PrintSelf(os, indent.GetNextIndent());
...@@ -337,6 +339,7 @@ vtkBillboardTextActor3D::vtkBillboardTextActor3D() ...@@ -337,6 +339,7 @@ vtkBillboardTextActor3D::vtkBillboardTextActor3D()
RenderedDPI(-1) RenderedDPI(-1)
{ {
std::fill(this->AnchorDC, this->AnchorDC + 3, 0.); std::fill(this->AnchorDC, this->AnchorDC + 3, 0.);
std::fill(this->DisplayOffset, this->DisplayOffset + 2, 0);
// Connect internal rendering pipeline: // Connect internal rendering pipeline:
this->Texture->InterpolateOff(); this->Texture->InterpolateOff();
...@@ -481,6 +484,10 @@ void vtkBillboardTextActor3D::GenerateQuad(vtkRenderer *ren) ...@@ -481,6 +484,10 @@ void vtkBillboardTextActor3D::GenerateQuad(vtkRenderer *ren)
anchorDC[0] = std::floor(anchorDC[0]); anchorDC[0] = std::floor(anchorDC[0]);
anchorDC[1] = std::floor(anchorDC[1]); 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: // Cached for OpenGL2 GL2PS exports:
this->AnchorDC[0] = anchorDC[0]; this->AnchorDC[0] = anchorDC[0];
this->AnchorDC[1] = anchorDC[1]; this->AnchorDC[1] = anchorDC[1];
......
...@@ -48,6 +48,15 @@ public: ...@@ -48,6 +48,15 @@ public:
vtkGetStringMacro(Input) 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. * The vtkTextProperty object that controls the rendered text.
* @{ * @{
...@@ -105,6 +114,9 @@ protected: ...@@ -105,6 +114,9 @@ protected:
char *Input; char *Input;
vtkTextProperty *TextProperty; vtkTextProperty *TextProperty;
// Offset in display coordinates.
int DisplayOffset[2];
// Cached metadata to determine if things need rebuildin' // Cached metadata to determine if things need rebuildin'
int RenderedDPI; int RenderedDPI;
vtkTimeStamp InputMTime; vtkTimeStamp InputMTime;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment