X
30 Rate this article:
No rating

INTERNAL: IDLgrWindow::Pickdata functionality for picking objects hidden behind others

Anonym
Topic:

IDLgrWindow::Pickdata only picks the point on the object closest to the eye. It will not return locations on objects that are hidden behind other objects.
Discussion:

Below is a method that will return the location on any object that has been hit even if the object is hidden behind other objects.Solution:
 
function idlgrwindow::pickobjdata,view,obj,loc,xyz
compile_opt idl2,hidden
select=self->select(view,loc)
if (n_elements(select) lt 2) then return,self->pickdata(view,obj,loc,xyz)
view->getproperty,location=location,dimension=dimension,viewplane_rect=vr
newloc=loc
newdim=[1,1]
self->getproperty, dim=dim
newvr=[vr[0:1]+double(newloc)/dim*vr[2:3],double(newdim)/dim*vr[2:3]]
view->setproperty,location=newloc,dimension=newdim,viewplane=newvr
hidden=bytarr(n_elements(select))
for j=0,n_elements(select)-1 do begin
select[j]->getproperty,hide=hide
hidden[j]=hide
select[j]->setproperty,/hide
endfor
obj->setproperty,hide=0
self->draw,view
res=self->pickdata(view,obj,loc,xyz)
for j=0,n_elements(select)-1 do select[j]->setproperty,hide=hidden[j]
self->draw,view
view->setproperty,location=location,dimension=dimension,viewplane_rect=vr
return, res
end