comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: IDLgrWindow Pickdata on an IDLexObjView Obect.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: IDLgrWindow Pickdata on an IDLexObjView Obect. [message #25379] Tue, 12 June 2001 06:25
Don J Lindler is currently offline  Don J Lindler
Messages: 19
Registered: April 2001
Junior Member
"Don J Lindler" <lindler@rockit.gsfc.nasa.gov> wrote in message
news:9g2til$hv5$1@skates.gsfc.nasa.gov...
> Does anyone have any suggestions on how to get the correct 3-D position
> using the Pickdata method for an IDLgrWindow object which is displaying an
> IDLexObjView. Pickdata correctly finds the objects but returns incorrect
> x,y,z values. I am trying to modify xplot3d.pro to return the x,y, and z
> coordinates of a IDLgrPolyline displayed using Orbs for each datapoint.
>
> Thanks,
> Don Lindler
>
>

Thanks for the input. It convinced me to keep looking for the problem. It
turns out that the routine XPLOT3D.PRO uses the following line to add the
model to the view.

Oview2 -> setproperty, subject = Omodel

which appears to be the same as:

Oview2 -> add, Omodel, /alias

When I replaced the line with simply:

Oview2 -> add, Omodel

Pickdata worked fine.

Thanks,
Don Lindler
Re: IDLgrWindow Pickdata on an IDLexObjView Obect. [message #25385 is a reply to message #25379] Mon, 11 June 2001 14:41 Go to previous message
m.hadfield is currently offline  m.hadfield
Messages: 36
Registered: April 2001
Member
> Does anyone have any suggestions on how to get the correct 3-D position
> using the Pickdata method for an IDLgrWindow object which is displaying an
> IDLexObjView. Pickdata correctly finds the objects but returns incorrect
> x,y,z values. I am trying to modify xplot3d.pro to return the x,y, and z
> coordinates of a IDLgrPolyline displayed using Orbs for each datapoint.

How are they incorrect?

I've never used an IDLexObjView before but I just coded up a short (and very
crude!) test program and the PickData method seemed to give the right
answers. The test program is below.

One odd thing that I noticed about IDLexObjView is that the Get method has
been overridden (subverted?) so that it returns a reference to the atom it's
displaying. I would expect a view's Get method to return the view's child
model(s). Overriding a superclass's key method like this so it does
something completely different is bad practice IMHO. The preferable way
would have been to add another method, called something like GetAtom. (This
may or may not be relevant to your problem. I wanted to look at the
transformation matrices of the models in the IDLexObjView.To get at them I
had to "Get" the atom then work up through the graphics tree. It turns out
there are 4 models and all have an identity transformation matrix. This
would change if the atom is manipulated by the mouse.)

Perhaps your problem is related to the fact that your 3D objects are
attached to a polyline as symbols?

---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield
National Institute for Water and Atmospheric Research

pro mgh_test_idlexobjview

; Create a view object

oview = obj_new('IDLexObjview')

; Create vertex & connectivity data for a sphere of unit radius

n_vertices = 30
mesh_obj, 4, vert, conn, replicate(1, n_vertices+1, n_vertices)

; Scale vertices & create spheroid object

vert[0,*] = 0.5 * vert[0,*]
vert[1,*] = 0.9 * vert[1,*]

oatom = obj_new('IDLgrPolygon', DATA=vert, POLY=conn)

; Add object to view

oview->Add, oatom

; Display

owin = obj_new('IDLgrWindow', UNITS=0, DIMENSIONS=[500,500], RETAIN=2,
GRAPHICS_TREE=oview)
owin->Draw

; Pick data

if owin->Pickdata(oview, oatom, [200,200], xyz) then $
print, 'Picked data at', xyz

; Skip remainder of code.

return

; Check that atoms, [X,Y,Z]RANGE properties are as expected.

oatom->GetProperty, XRANGE=xrange, YRANGE=yrange, ZRANGE=zrange

print, oatom,xrange,yrange,zrange

; Get all of the atom's parent models and print their transformation
matrices.

oatom->GetProperty, PARENT=omodel

while obj_isa(omodel, 'IDLgrModel') do begin

omodel->GetProperty, TRANSFORM=transform

print, omodel, transform

omodel->GetProperty, PARENT=omodel

endwhile

end



--
Posted from clam.niwa.cri.nz [202.36.29.1]
via Mailgate.ORG Server - http://www.Mailgate.ORG
Re: IDLgrWindow Pickdata on an IDLexObjView Obect. [message #25387 is a reply to message #25385] Mon, 11 June 2001 13:38 Go to previous message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
Hi Don,

"Don J Lindler" <lindler@rockit.gsfc.nasa.gov> wrote ...
> Does anyone have any suggestions on how to get the correct 3-D position
> using the Pickdata method for an IDLgrWindow object which is displaying an
> IDLexObjView. Pickdata correctly finds the objects but returns incorrect
> x,y,z values. I am trying to modify xplot3d.pro to return the x,y, and z
> coordinates of a IDLgrPolyline displayed using Orbs for each datapoint.

I've used this a lot, with good results. I'm not sure where you are calling
the PickData from, but here is one point to note. You should either:

1) call PickData passing the primitive graphic object itself, retrieved
using Select:

oSel = oWindow -> Select(oView, [event.x, event.y]) ; returns object array

IF Size(oSel, /TName) EQ 'OBJREF' THEN BEGIN ; no selection returns -1

pick = oWindow-> PickData(oView, oSel[0], [event.x, event.y], dataXYZ)

ENDIF

or:

2) call PickData passing the "innermost" model that contains the object
directly (note: in an IDLexObjView, it is that view's oModel3 that
contains added non-stationary objects, and this model can only be
accessed inside a method of IDLexObjView or a subclass of it.
IDLexObjView::Update is a good place to use this)

"self" would be the instance of IDLexObjView:
pick = oWindow -> PickData(self, self.oModel3, [event.x, event.y], dataXYZ)

Hope this helps!

Cheers,
--
-Dick

Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Mapping question...
Next Topic: netplan

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:39:34 PDT 2025

Total time taken to generate the page: 0.00726 seconds