<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
span.EstiloCorreo17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1928689707;
        mso-list-type:hybrid;
        mso-list-template-ids:-187903896 -739073358 201981955 201981957 201981953 201981955 201981957 201981953 201981955 201981957;}
@list l0:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:-;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:"Times New Roman";}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=ES link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hi there!<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US>We need a vtkWidget that behaves in a similar way to a vtkCaptionActor2D. And that is:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>- A billboarding text<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>- An attachment point<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>- A leader to the attachment point<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>- Position and position2<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>- Translation (using dragging) functionality<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>- Everything must be in world coordinates (we don’t want to show the text in display coordinates)<u><o:p></o:p></u></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>We have been trying vtkCaptionWidget, that seems to be the right choice, but are experiencing problems when we try to translate it via dragging. As we show in the attached code, we change vtkCaptionRepresentation points one and two, to world coordinate system. The problem is that when we move the camera around the sphere, the background rectangle seems not to be billboarding as the text does, and that’s is causing problems when we want to drag the text.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>We would appreciate if any of you can run the test application attached and experience the problem.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Thanks in advance,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Robert.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Code and CMakeList.txt file:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>#include <vtkPolyDataMapper.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>#include <vtkActor.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>#include <vtkRenderWindow.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>#include <vtkRenderer.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>#include <vtkRenderWindowInteractor.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>#include <vtkPolyData.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>#include <vtkSmartPointer.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>#include <vtkSphereSource.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>#include <vtkCaptionRepresentation.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>#include <vtkCaptionActor2D.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>#include <vtkTextActor.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>#include <vtkTextProperty.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>#include <vtkCaptionWidget.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>#include <vtkInteractorStyleTrackballCamera.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>int main(int, char *[])<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>{<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> vtkSmartPointer<vtkSphereSource> sphereSource = vtkSmartPointer<vtkSphereSource>::New();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> sphereSource->Update();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> mapper->SetInputConnection(sphereSource->GetOutputPort());<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> actor->SetMapper(mapper);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> renderer->SetBackground(1,0,0);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> renderWindow->SetSize(800, 600);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> renderWindow->AddRenderer(renderer);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> renderer->AddActor(actor);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> renderWindowInteractor->SetInteractorStyle(vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New());<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> renderWindowInteractor->SetRenderWindow(renderWindow);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US> vtkSmartPointer<vtkCaptionRepresentation> captionRepresentation;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> vtkSmartPointer<vtkCaptionWidget> captionWidget;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US> captionRepresentation = vtkSmartPointer<vtkCaptionRepresentation>::New();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> captionRepresentation->GetPositionCoordinate()->SetCoordinateSystemToWorld();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> captionRepresentation->GetPosition2Coordinate()->SetCoordinateSystemToWorld();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> captionRepresentation->GetCaptionActor2D()->SetCaption("Drag me!");<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> captionRepresentation->GetCaptionActor2D()->GetTextActor()->SetTextScaleModeToNone();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> captionRepresentation->GetCaptionActor2D()->GetTextActor()->GetTextProperty()->SetFontSize(100);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> captionRepresentation->GetCaptionActor2D()->GetTextActor()->GetTextProperty()->ItalicOff();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> captionRepresentation->GetCaptionActor2D()->GetTextActor()->GetTextProperty()->ShadowOff();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> captionRepresentation->GetCaptionActor2D()->GetTextActor()->GetTextProperty()->BoldOff();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US> double anchorPos[3] = {0.5, 0.0, 0.0};<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> double pos[3] = {1.0, 0.0, 0.0};<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> captionRepresentation->SetAnchorPosition(anchorPos);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> captionRepresentation->SetPosition(pos);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US> captionWidget = vtkSmartPointer<vtkCaptionWidget>::New();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> captionWidget->SetResizable(false);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> captionWidget->SetInteractor(renderWindowInteractor);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> captionWidget->SetRepresentation(captionRepresentation);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> renderWindow->Render();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> captionWidget->On();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US> renderWindowInteractor->Start();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> return EXIT_SUCCESS;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>}<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>/////////////////////////////////////////////////<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>cmake_minimum_required(VERSION 2.8)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>PROJECT(CaptionWidget)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>find_package(VTK REQUIRED)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>include(${VTK_USE_FILE})<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>message (${VTK_USE_FILE})<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>add_executable(CaptionWidget CaptionWidget)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>target_link_libraries(CaptionWidget vtkHybrid vtkWidgets)<o:p></o:p></span></p></div></body></html>