<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 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@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";}
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;}
span.E-MailFormatvorlage17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
-->
</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=DE link=blue vlink=purple>
<div class=WordSection1>
<p class=MsoNormal>Dear vtk-users,<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span lang=EN-US>I want to use a vtkSphereWidget in my scene
to orient a geometry. Currently, I have to press the key “i” to
enable this widget (i.e. make the handle visible). However, I want to enable
this widget once the widget geometry is shown in my render window. For this
purpose I add an observer to my renderer with the parameters “vtkCommand::StartEvent”
and a derived class of vtkCommand as callback-command. Additionally, I set a
pointer to the vtkSphereWidget in my derived callback-command. When the event is
processed (and I proved that this event is throwing!), I call “SetEnabled(1)”
in my derived callback-command. However, the handle is not visible. I need to
press the “i”-key to make it visible. I also tried to add observers
to the interactor but the problem is still the same.<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>Can anybody give me a hint what I’m
doing wrong?<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>Thanks in advance, Rocco<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>P.S. Here is a code snippet of what I’m
doing currently:<o:p></o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>// The main-class:<o:p></o:p></p>
<p class=MsoNormal>…<o:p></o:p></p>
<p class=MsoNormal>vtkSmartPointer<vtkSphereWidget> sphereWidget = vtkSmartPointer<vtkSphereWidget>::New(); <o:p></o:p></p>
<p class=MsoNormal>sphereWidget ->SetInteractor(windowInteractor);<o:p></o:p></p>
<p class=MsoNormal>sphereWidget ->SetCurrentRenderer(renderer);<o:p></o:p></p>
<p class=MsoNormal>sphereWidget ->SetEnabled(1);<o:p></o:p></p>
<p class=MsoNormal>sphereWidget ->SetHandleSize(0.03);<o:p></o:p></p>
<p class=MsoNormal>sphereWidget ->SetPhiResolution(20);<o:p></o:p></p>
<p class=MsoNormal>sphereWidget ->SetThetaResolution(20);<o:p></o:p></p>
<p class=MsoNormal>sphereWidget ->GetSphereProperty()->BackfaceCullingOn();<o:p></o:p></p>
<p class=MsoNormal>sphereWidget ->SetHandleVisibility(1);<o:p></o:p></p>
<p class=MsoNormal>…<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>vtkSmartPointer<vtkMyWidgetCallback> widgetCallback = vtkSmartPointer<vtkMyWidgetCallback>::New();<o:p></o:p></p>
<p class=MsoNormal>widgetCallback->SetWidget(sphereWidget);<o:p></o:p></p>
<p class=MsoNormal>renderer->AddObserver(vtkCommand::StartEvent, widgetCallback);<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>// The derived vtkCommand class<o:p></o:p></p>
<p class=MsoNormal>class vtkMyWidgetCallback : public vtkCommand<o:p></o:p></p>
<p class=MsoNormal>{<o:p></o:p></p>
<p class=MsoNormal>public:<o:p></o:p></p>
<p class=MsoNormal> static
vtkMyWidgetCallback *New()<o:p></o:p></p>
<p class=MsoNormal> {<o:p></o:p></p>
<p class=MsoNormal> return
new vtkMyWidgetCallback;<o:p></o:p></p>
<p class=MsoNormal> }<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal> virtual
void Execute(vtkObject *caller, unsigned long, void*)<o:p></o:p></p>
<p class=MsoNormal> {<o:p></o:p></p>
<p class=MsoNormal> <span
lang=EN-US><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US>sphereWidget ->SetEnabled(1);<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> sphereWidget
->SetHandleVisibility(1);<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> cout
<< "Widget on!" << endl;<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> void
SetWidget(vtkSphereWidget* widget);<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> vtkSphereWidget*
sphereWidget;<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>inline void vtkMyWidgetCallback::SetWidget(vtkSphereWidget*
widget)<o:p></o:p></span></p>
<p class=MsoNormal>{<o:p></o:p></p>
<p class=MsoNormal> <span
lang=EN-US>sphereWidget</span><span lang=EN-US> </span>= widget;<o:p></o:p></p>
<p class=MsoNormal>}<o:p></o:p></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>
</div>
</body>
</html>