[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IDLgrWindow Pickdata on an IDLexObjView Obect.

> 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,

    ; Pick data

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

    ; Skip remainder of code.


    ; 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

    oatom->GetProperty, PARENT=omodel

    while obj_isa(omodel, 'IDLgrModel') do begin

        omodel->GetProperty, TRANSFORM=transform

        print, omodel, transform

        omodel->GetProperty, PARENT=omodel



Posted from clam.niwa.cri.nz [] 
via Mailgate.ORG Server - http://www.Mailgate.ORG