<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<STYLE type=text/css>BODY {
        OVERFLOW-Y: auto; OVERFLOW-X: auto; MARGIN: 3px; FONT: 12px Arial
}
P {
        MARGIN: 0px
}
BLOCKQUOTE {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
OL {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
UL {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
</STYLE>
<META content="MSHTML 6.00.2900.2627" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>You can use this :</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>public void mouseClicked(MouseEvent e){</FONT></DIV>
<DIV><FONT size=2><FONT size=2>
<P> vtkPropPicker pickActor = </FONT><FONT
size=2>new</FONT><FONT size=2> vtkPropPicker();</P>
<P> pickActor.PickProp(</P>
<P></FONT><FONT size=2>
e.getX()</FONT><FONT size=2>,</P>
<P></FONT><FONT size=2>
renWin</FONT><FONT size=2>.GetRenderWindow().GetSize()[1] - </FONT><FONT
size=2>e.getY</FONT><FONT size=2>,</P>
<P></FONT><FONT size=2>
renWin</FONT><FONT size=2>.GetRenderer());</P>
<P> vtkActor actorPicked = pickActor.GetActor();</P>
<P></FONT><FONT size=2> if</FONT><FONT size=2>
(actorPicked == yourActor) {</P>
<P></FONT><FONT size=2> vtkCellPicker
pickCell = </FONT><FONT size=2>new</FONT><FONT size=2> vtkCellPicker();</P>
<P> pickCell.Pick(</P>
<P></FONT><FONT
size=2>
e.getX()</FONT><FONT size=2>,</P>
<P></FONT><FONT
size=2>
renWin</FONT><FONT size=2>.GetRenderWindow().GetSize()[1] - </FONT><FONT
size=2>e.getY()</FONT><FONT size=2>,</P>
<P> 0,</P>
<P></FONT><FONT
size=2>
renWin</FONT><FONT size=2>.GetRenderer());</P>
<P></FONT><FONT size=2>
System.out.println(</FONT><FONT size=2>pickCell.GetCellId());</FONT></P>
<P> }</P>
<P><FONT size=2>}</FONT></P>
<P><FONT size=2></FONT> </P>
<P><FONT size=2>renWin is your vtkPanel</FONT></P>
<P><FONT size=2>yourActor is the actor you want to pick</FONT></P>
<P><FONT size=2></FONT> </P>
<P><FONT size=2>You don't need to use a vtkRenderWindowInteractor </FONT></P>
<P><FONT size=2>the vtkPanel make the same thing.</P></FONT></FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=desbos.alban@caramail.com
href="mailto:desbos.alban@caramail.com">alban desbos</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=vtkusers@vtk.org
href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, May 24, 2005 2:23 PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [vtkusers] Cell Picking in
Java</DIV>
<DIV><BR></DIV>
<DIV style="DISPLAY: block; FONT-SIZE: 12px; FONT-FAMILY: Arial">
<P>Hi,</P>
<P> </P>
<P>I have a problem with the cell picking in Java.</P>
<P>When I click with the mouse, I want to know the cell Id, but I often get a
wrong result.</P>
<P>I tried with different tolerance values but it's still the same thing.</P>
<P>If someone know how to use vtkPicker with Java. Thank you in advance.</P>
<P>Alban</P>
<P> </P>
<P>//renWin is a vtkPanel</P>
<P>iren = new
vtkRenderWindowInteractor();<BR>iren.SetRenderWindow(renWin.GetRenderWindow());</P>
<P>...</P>
<P>public void mouseClicked(MouseEvent e) {</P>
<P> picker = new
vtkCellPicker();<BR> iren.SetPicker(picker);
//iren<BR> picker.SetTolerance(0.01);<BR> picker.Pick(e.getX(),
e.getY(), 0,
renWin.GetRenderer());<BR> System.out.println(picker.GetCellId());<BR> }</P><BR>
<P
style="BACKGROUND-POSITION: 0px 0px; MARGIN-TOP: 11px; BACKGROUND-IMAGE: url(http://mail.lycos.co.uk/Images/Mail/_content/dot.gif); PADDING-TOP: 3px; BACKGROUND-REPEAT: repeat-x"><B>La
puissance n’est pas innée : elle se construit.</B> <A
href="http://ads.lycos-europe.com/event.ng/Type=click&FlightID=190429&AdID=411354&TargetID=null&Segments=19885,2789&Targets=null&Values=243,292,24179,24195,24736,229&RawValues=&Redirect=http://www.nike.com/freeeurope/?l=fr_fr&cid=902"
target=_blank>Cliquez ici pour découvrir Nike Free !</A></P></DIV><BR><BR>
<P>
<HR>
<P></P>_______________________________________________<BR>This is the private
VTK discussion list. <BR>Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ<BR>Follow this link to
subscribe/unsubscribe:<BR>http://www.vtk.org/mailman/listinfo/vtkusers<BR><BR><BR></BLOCKQUOTE></BODY></HTML>