convert_coord & overplotting across multiple widget draw windows [message #82669] |
Wed, 09 January 2013 17:20  |
havok2063
Messages: 24 Registered: December 2012
|
Junior Member |
|
|
I have 2 widget draw windows and I want to click and highlight in one and plot something in the other. I've managed to get the mouse coords to convert properly upon switching back and forth between windows, but when I overplot lines for highlighting, the lines, after the first call, either become shifted or do not plot at all. So something is still not quite right with the window coord system.
I've set the 1 window to be the active one and I load in that window's !x, and !y so I'm not sure what else I need to do to get it to consistently overplot.
My code is something like
(*pState).wDrawFlux:begin
widget_control, (*pState).wDrawFlux, get_value=value, get_uvalue=uvalue
case event.type of
;button press
0:begin
;left mouse button press
if event.press eq 1 then begin
print, 'left mouse button pressed!'
wset, value
!x=(*pState).fluxd.x
!y=(*pState).fluxd.y
dataxy = convert_coord(event.x, event.y, /device, /to_data)
fiberid = floor(dataxy[1])
print, 'Fiber id: '+strtrim(fiberid,2)
;highlight
oplot, [-5000,5000], fltarr(2)+fiberid, color=!red
oplot, [-5000,5000], fltarr(2)+fiberid+1, color=!red
;plot in other window
widget_control, (*pState).wDrawSpec, get_value=specwin
wset, specwin
plot, flat[*,fiberid]
dot dot dot
Thanks for any help.
|
|
|
Re: convert_coord & overplotting across multiple widget draw windows [message #82726 is a reply to message #82669] |
Fri, 11 January 2013 18:04  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Brian Cherinka writes:
> Thanks a lot. This helps a lot. This pixmap is neat and a little confusing at the same time, especially when you're juggling them over 3 different windows back and forth. I've got it working now though, both for my over-plotting and for zooming with the rubberband zoom box. My next step is to try to add image panning.
You can use cgZPlot as an example, if you want. After you
zoom in, you can use the right mouse button to pan.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|