Re: Selecting objects and PickData problem [message #21147] |
Thu, 10 August 2000 00:00 |
promashkin
Messages: 169 Registered: December 1999
|
Senior Member |
|
|
I have used PickData in a very similar fashion as Richard wants to use
it. I did not modify the point value but used point's exact location to
go back to the process that created that particular point. I was unable
to directly use the output of PickData method. Instead, I had to locate
the point in my Plot data that was closest to the location returned by PickData:
x_loc_hi = (where(plot_data[0, *] ge return_XY[0]))[0]
x_loc_lo = (reverse(where(plot_data[0, *] le return_XY[0])))[0]
if abs(x_loc_hi - return_XY[0]) le abs(x_loc_lo - return_XY[0]) then $
x_loc = x_loc_hi else x_loc = x_loc_lo
In my case, data were sorted and no Y search was necessary. More general
approach would repeat this for the Y dimension, and Z too, I guess.
This way, I was able to extract the point I needed.
From here, it would be very simple to make that point "follow" the
cursor (by turning ON drag events until mouse release and changing the
value of the found plot point). However, given the fact that mousing on
the plot area never seemed to hit the exact point I tried to hit, I am
not sure I'd like to set my data points using this method, unless for
some sort of initial guess.
I have a feeling that this uncertainty originates from PickData using
input device coordinates to figure out if a click hit a plot. Then, if
you happen to hit within some neighborhood of the plot object, PickData
will return TRUE, although from the display device (which uses pixels)
it can't tell what Plot value did you hit. Then PickData will return a
value, probably corresponding to the center of that neighborhood, which
is close to the value of Plot data point.
As you can tell, it is all pure speculation. But I used the workaround
and it worked for me.
Cheers,
Pavel
|
|
|
Re: Selecting objects and PickData problem [message #21148 is a reply to message #21147] |
Thu, 10 August 2000 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Richard Tyc (richt@sbrc.umanitoba.ca) writes:
> I am trying to get object selection (and ultimately manipulation
> interactively) to work properly without much success.
>
> I understand from previous postings and David Fannings example that the
> method first requires:
>
> 1) perform a selObj = oWIndow->Select ( oView, [sEvent.x,sEvent.y] )
> operation to get the list of objects which could be picked from.
>
> 2) Assuming my object of choice is in the list (I check on the NAME property
> for each object which I have previously assigned), I can then do something
> like
>
> pick = oWindow->PickData( oView, pickObj, [sEvent.x,sEvent.y], dataxyz)
>
> My problem is that the PickData method does work ( ie. the right pickObj is
> found from the original selection list) but the actual data in dataxyz makes
> no sense!! My object of choice, an IDLgrPolyLine, is part of oModel
> contained in oView which has been transformed. I display the X,Yand Z axis
> on screen when I manipulate the Model (using oTrackball type interaction)
> but the PickData returns data outside my bounds ie. the entire polyline is
> within positive X,Y,Z but yet dataxyz returns negative positions ?
> Does dataxyz not have the correct transformed data ? Is there a bug here ?
>
> I am trying to allow the user to interactively grap the end point of a line
> and modify its position by moving the mouse.
I don't know, Richard. I haven't tried this particular
thing. But I do see a lot of caveats in the on-line help
for the PickData method, including caveats that you may
have to apply your own data transformations to these
values. Have you read the documentation carefully?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|