<DIV>Hi John,</DIV>
<DIV> </DIV>
<DIV>Thanks for having replied. </DIV>
<DIV> </DIV>
<DIV>- First of all, sure that I am very interested in your <FONT color=#000080><FONT color=#000000><STRONG>vtkGlyph2DMapper</STRONG>; I think this is very convenient to use and is exactly what I am looking for. </FONT></FONT></DIV>
<DIV> </DIV>
<DIV>- Then, my actual work is inspiring from the example <STRONG>LiverTumorSegmentation</STRONG> application and I think that maybe <STRONG>I don't really need to use vtkPointPicker</STRONG> but just handling LeftButtonPressEvent event instead. Indeed, I took a look on the Pick() method of this class and it calls <STRONG>SetDisplayPoint(), DisplayToWorld() and GetWorldPoint() </STRONG>methods as I was already doing in my own class. </DIV>
<DIV> </DIV>
<DIV>- So, this is what is done for now: as in <STRONG>LiverTumorSegmentation</STRONG>, I have 2 classes: one for MFC handling <STRONG>CView</STRONG> and the other for viewing slices <STRONG>vtkSliceViewer</STRONG>:</DIV>
<DIV> </DIV>
<DIV><STRONG>void CView::Pipeline()<BR>{<BR> viewer.SetInput(image);</STRONG> //vtkSliceViewer viewer</DIV>
<DIV><STRONG> viewer.SetInteractor( interactor ); <BR> interactor->SetInstallMessageProc(false);<BR> interactor->Initialize();</STRONG></DIV>
<DIV><STRONG>}</STRONG></DIV>
<DIV> </DIV>
<DIV><STRONG>LRESULT CView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)<BR>{<BR>if(message == WM_LBUTTONDOWN)</STRONG></DIV>
<DIV><STRONG>{</STRONG></DIV>
<DIV><STRONG> if ( this->interactor->GetInitialized() )<BR> {<BR> return vtkHandleMessage2(this->m_hWnd, message, wParam, lParam, this->interactor);<BR> }</STRONG></DIV>
<DIV><STRONG> }</STRONG></DIV>
<DIV><STRONG>else <BR> return CFormView::WindowProc(message, wParam, lParam);<BR>}</STRONG></DIV>
<DIV> </DIV>
<DIV>the other class vtkSliceviewer:</DIV>
<DIV> </DIV>
<DIV><STRONG>void vtkSliceViewer::SetInteractor( vtkRenderWindowInteractor * interactor )<BR>{<BR> interactor->SetRenderWindow(m_RenderWindow);</STRONG></DIV>
<DIV><STRONG> interactor->SetInteractorStyle(NULL);</STRONG></DIV>
<DIV><STRONG> </STRONG></DIV>
<DIV><STRONG> //create a callback for the left mouseclick<BR> MyInteractorCallback* m_pInteractorCallback = MyInteractorCallback::New();<BR> m_pInteractorCallback->SetImageSliceViewer(this); <BR> interactor->AddObserver( vtkCommand::LeftButtonPressEvent, m_pInteractorCallback);<BR>}</STRONG></DIV>
<DIV> </DIV>
<DIV><STRONG>class MyInteractorCallback : public vtkCommand<BR>{<BR>public:<BR> static MyInteractorCallback *New() { return new MyInteractorCallback;}<BR> <BR> virtual void Execute(vtkObject *caller, unsigned long eventId, void *callData)<BR> {<BR> vtkWin32RenderWindowInteractor *interactor = reinterpret_cast<vtkWin32RenderWindowInteractor *>(caller);<BR> int x = interactor->GetEventPosition()[0];<BR> int y = interactor->GetEventPosition()[1];<BR> m_viewer->SelectPoint(x,y);</STRONG><BR> <STRONG> }<BR> <BR> void SetImageSliceViewer(vtkSliceViewer* viewer){m_viewer = viewer;}</STRONG></DIV>
<DIV><STRONG>private:<BR> MyInteractorCallback(){m_viewer = NULL;}<BR> vtkSliceViewer* m_viewer; <BR>};</STRONG></DIV>
<DIV> </DIV>
<DIV><STRONG>void vtkSliceViewer::SelectPoint( int x, int y )<BR>{<BR> TRACE("ds SelectPoint\n"); //check if my observer is called</STRONG></DIV>
<DIV><STRONG> </STRONG><FONT style="BACKGROUND-COLOR: #ffff00">--> displayed only when point clicked is outside the render window!!!!!!!!</FONT></DIV>
<DIV><STRONG></STRONG> </DIV>
<DIV><STRONG> </STRONG>// Convert display point to world point</DIV>
<DIV><STRONG> double world_point[4];<BR> m_Renderer->SetDisplayPoint( x, y, 0 );<BR> m_Renderer->DisplayToWorld();<BR> m_Renderer->GetWorldPoint( world_point );</STRONG></DIV>
<DIV><STRONG> double realz = m_SliceNum * spacing[2] + origin[2];<BR> world_point[2] = realz;</STRONG></DIV>
<DIV><STRONG> //mark point clicked on viewer<BR> this->SelectPoint(world_point[0], world_point[1], world_point[2]);<BR>}</STRONG></DIV>
<DIV><BR>- But I am really confused with something strange: <STRONG>my renderwindow is just a part of the MFC window (CView</STRONG>). Yet, when I pressed left button mouse in the window class, SelectPoint() is called only when my clicked point is not in the render window. I checked out if my interactor size was set to correct dimensions and it is actually the case. <STRONG>But I can't figure out why my function is called only when I clicked outside the render window.</STRONG> </DIV>
<DIV> </DIV>
<DIV>Any idea???</DIV>
<DIV> </DIV>
<DIV>Isabelle</DIV>
<DIV> </DIV>
<DIV><BR><B><I>John Platt <jcplatt@lineone.net></I></B> a écrit :</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">
<META content="Microsoft Word 10 (filtered)" name=Generator>
<STYLE>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {margin-right:0cm;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle19
        {font-family:Arial;
        color:navy;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</STYLE>
<DIV class=Section1>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Hi Isabelle,</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">As far as I can see, the pick events are fired by the Pick() method of the interactor’s picker. If you want to observe these events, you must add the observers to the picker, not the interactor. You must also arrange for the Pick() method to be called.</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">As a start, in the check for LeftButtonPressEvent, call Pick() with the current mouse event position and then get the point id -</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> int x = interactor->GetEventPosition()[0];</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> int y = interactor->GetEventPosition()[1];</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> vtkPointPicker* picker = interactor->GetPicker(); </SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> picker->Pick( (double)x, (double)y, 0, renderer );</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> int pointId = picker->GetPointId();</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">and print the point Id using the TRACE macro. If you cannot get the LeftButtonPressEvent, see the recent thread on “handle right mouse click”.</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">I have drawn various 2D shapes, by first creating a polydata object, and then, as each point is clicked, add the point as a vertex to the polydata. The polydata is set as input to vtkGlyph2DMapper (very similar to vtkTextMapper). This mapper takes vtkGlyphSource2D as a source and copies the specified shape (diamond, circle, square etc.) to each of the points in the polydata. The mapper then feeds a single vtkActor2D. Something like …</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> vtkGlyphSource2D* vtkGlyphSource = vtkGlyphSource2D::New();</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> vtkGlyphSource->SetGlyphTypeToCircle();</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> m_vtkGlyphMapper = vtkGlyph2DMapper::New();</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> m_vtkGlyphMapper->SetInput( m_vtkInputPolyData );</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> m_vtkGlyphMapper->SetSource( vtkGlyphSource->GetOutput() );</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> vtkGlyphSource->Delete();</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> m_vtkGlyphActor = vtkActor2D::New();</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> m_vtkGlyphActor->SetMapper( m_vtkGlyphMapper );</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">I can let you have the mapper if you think it would be helpful.</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">John.</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">-----Original Message-----<BR><B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> vtkusers-bounces+jcplatt=lineone.net@vtk.org [mailto:vtkusers-bounces+jcplatt=lineone.net@vtk.org] <B><SPAN style="FONT-WEIGHT: bold">On Behalf Of </SPAN></B>Renaud Isabelle<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> </SPAN></FONT><FONT face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">18 August 2005</SPAN></FONT><FONT face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"> </SPAN></FONT><FONT face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">16:32</SPAN></FONT><FONT face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> vtkusers@public.kitware.com<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> [vtkusers] help with interactor and
MFC</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">Hi guys, </SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">I have to implement user interaction with my renderwindow in MFC: </SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">user picks points on the displayed medical image and notices them with spheres. I saw that I have to use <STRONG><B><FONT face="Times New Roman">vtkHandleMessage2</FONT></B></STRONG> with <STRONG><B><FONT face="Times New Roman">vtkWin32RenderWindowInteractor</FONT></B></STRONG> to handle a left button mouse click and <STRONG><B><FONT face="Times New Roman">interactor->AddObserver()</FONT></B></STRONG> to call a function to handle it. </SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">But now, I see that <STRONG><B><FONT face="Times New Roman">vtkPointPicker</FONT></B></STRONG> exists and that is doing the same thing. I am really a bit confused with all the options. Here is what I did:</SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"> <STRONG><B><FONT face="Times New Roman">interactor->SetRenderWindow(m_RenderWindow);</FONT></B></STRONG></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><STRONG><B><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"> interactor->SetInteractorStyle(NULL);</SPAN></FONT></B></STRONG></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><STRONG><B><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"> vtkPointPicker *picker = vtkPointPicker::New();</SPAN></FONT></B></STRONG></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><STRONG><B><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"> interactor->SetPicker(picker);</SPAN></FONT></B></STRONG></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"> </SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"> <STRONG><B><FONT face="Times New Roman">vtkMyCallback* how_execute = vtkMyCallback::New();</FONT></B></STRONG><B><SPAN style="FONT-WEIGHT: bold"><BR><STRONG><B><FONT face="Times New Roman"> interactor->AddObserver( vtkCommand::LeftButtonPressEvent, how_execute );</FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> interactor->AddObserver( vtkCommand::EndPickEvent, how_execute);</FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> </FONT></B></STRONG></SPAN></B></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><STRONG><B><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"> interactor->SetInstallMessageProc(false);</SPAN></FONT></B></STRONG><B><SPAN style="FONT-WEIGHT: bold"><BR><STRONG><B><FONT face="Times New Roman"> interactor->Initialize();</FONT></B></STRONG></SPAN></B></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">LRESULT CMyView::<STRONG><B><FONT face="Times New Roman">WindowProc(UINT message, WPARAM wParam, LPARAM lParam)</FONT></B></STRONG><B><SPAN style="FONT-WEIGHT: bold"><BR></SPAN></B>{<BR> // TODO: Add your specialized code here and/or call the base class<BR> <STRONG><B><FONT face="Times New Roman">switch ( message )</FONT></B></STRONG><B><SPAN style="FONT-WEIGHT: bold"><BR><STRONG><B><FONT face="Times New Roman"> {</FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> case WM_LBUTTONDOWN:</FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> if ( this->interactor->GetInitialized() )</FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> {</FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> return vtkHandleMessage2(this->m_hWnd, message, wParam, lParam,
this->interactor);</FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> }</FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> break;</FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> }</FONT></B></STRONG><BR></SPAN></B> <STRONG><B><FONT face="Times New Roman">return CFormView::WindowProc(message, wParam, lParam);</FONT></B></STRONG><B><SPAN style="FONT-WEIGHT: bold"><BR><STRONG><B><FONT face="Times New Roman">}</FONT></B></STRONG></SPAN></B></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><STRONG><B><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">class vtkMyCallback : public vtkCommand</SPAN></FONT></B></STRONG><B><SPAN style="FONT-WEIGHT: bold"><BR><STRONG><B><FONT face="Times New Roman">{</FONT></B></STRONG></SPAN></B></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><STRONG><B><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">public:</SPAN></FONT></B></STRONG></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><STRONG><B><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"> static vtkMyCallback *New() { return new vtkMyCallback; }</SPAN></FONT></B></STRONG><B><SPAN style="FONT-WEIGHT: bold"><BR><STRONG><B><FONT face="Times New Roman"> </FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> virtual void Execute(vtkObject *caller, unsigned long eventId, void*)</FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> {</FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> vtkRenderWindowInteractor* interactor = reinterpret_cast<vtkRenderWindowInteractor*>(caller);</FONT></B></STRONG></SPAN></B></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"> </SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"> <STRONG><B><FONT face="Times New Roman">if(eventId == vtkCommand::LeftButtonPressEvent)</FONT></B></STRONG><B><SPAN style="FONT-WEIGHT: bold"><BR><STRONG><B><FONT face="Times New Roman"> { </FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> int point[2];</FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> interactor->GetEventPosition(point);</FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> m_viewer->SelectPoint(point[0],point[1]);</FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> }</FONT></B></STRONG></SPAN></B></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"> <STRONG><B><FONT face="Times New Roman">if(eventId == vtkCommand::EndPickEvent)</FONT></B></STRONG><B><SPAN style="FONT-WEIGHT: bold"><BR><STRONG><B><FONT face="Times New Roman"> { </FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> vtkPointPicker* picker = (vtkPointPicker*) interactor->GetPicker();</FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> if(picker->GetPointId() != -1)</FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> {</FONT></B></STRONG><BR><STRONG><B><FONT face="Times New Roman"> float* position =
picker->GetPickPosition();</FONT></B></STRONG></SPAN></B></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><STRONG><B><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"> m_sphereActor->SetPosition(position);</SPAN></FONT></B></STRONG><B><SPAN style="FONT-WEIGHT: bold"><BR><STRONG><B><FONT face="Times New Roman"> }</FONT></B></STRONG></SPAN></B><BR> }<BR>}</P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">- This seems not to work. I think that I have to choose between handling one of the event: LeftButtonPressEvent or EndPickEvent. But I don't know what is the best option. Could someone tell me what is best? </SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">- Btw, my purpose is to add a circle on each point that user picked. Do I have to handle a <STRONG><B><FONT face="Times New Roman">array of vtkSphereSource</FONT></B></STRONG> to display so many spheres?</SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">Thanks for replyiong, guys,</SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">Isabelle</SPAN></FONT></P></DIV>
<DIV class=MsoNormal style="MARGIN-LEFT: 36pt; TEXT-ALIGN: center" align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
<HR align=center width="100%" SIZE=1>
</SPAN></FONT></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><B><FONT face="Times New Roman" color=red size=3><SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; COLOR: red">Appel audio GRATUIT</SPAN></FONT> partout dans le monde</B> avec le nouveau Yahoo! Messenger<BR><A href="http://us.rd.yahoo.com/messenger/mail_taglines/default/*http:/fr.messenger.yahoo.com">Téléchargez le ici !</A> </P></DIV></BLOCKQUOTE><p>
                <hr size=1>
<b><font color=#FF0000>Appel audio GRATUIT</font> partout dans le monde</b> avec le nouveau Yahoo! Messenger<br>
<a href="http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.messenger.yahoo.com">Téléchargez le ici !</a>