Hey,
can anybody tell me, what I'm doing wrong ?
I'm comparing the code for 2 hours now and I don't get it.
Seems to having lost the z-dimension :(
I can rotate the Volume only in 1 dimension but I really need the
others, too!
here we go (requires IDLexRotator):
PRO TDVol_Event, event
WIDGET_CONTROL, event.top, Get_UValue=info
IF (*info).Rotator->Update(event) THEN $
(*info).oWindow->Draw, (*info).View
END
PRO TDVol_Cleanup, tlb
WIDGET_CONTROL, tlb, Get_UValue=info
OBJ_DESTROY, (*info).View
OBJ_DESTROY, (*info).oWindow
OBJ_DESTROY, (*info).Rotator
OBJ_DESTROY, (*info).volume
PTR_FREE, info
END
PRO vol_test
image_size=200
tmp = BYTSCL(dist(image_size))
images = BYTARR(image_size, image_size, 10)
FOR i=0,9 DO images[*,*,i] = tmp
View = OBJ_NEW('IDLgrView', Viewplane_Rect=[-image_size/2.0, $
-image_size/2.0, image_size, image_size])
RotMod = OBJ_NEW('IDLgrModel')
Rotator = OBJ_NEW('IDLexRotator', [-image_size/2.0, $
-image_size/2.0], image_size/2)
volume = OBJ_NEW('IDLgrVolume', images, $
XCOORD_CONV=[-image_size/2.0, 1], $
YCOORD_CONV=[-image_size/2.0, 1], /NO_COPY)
View->Add, Rotator
Rotator->Add, RotMod
RotMod->Add, volume
TLB = WIDGET_BASE()
drawID = WIDGET_DRAW(TLB, XSize=image_size, YSize=image_size, $
/button_events, /motion_events, graphics_level=2)
WIDGET_CONTROL, TLB, /Realize
WIDGET_CONTROL, drawID, Get_Value=oWindow
oWindow->Draw, View
info = PTR_NEW({ View:View, oWindow:oWindow, $
Rotator:Rotator, volume:volume})
WIDGET_CONTROL, TLB, Set_UValue=info
XMANAGER, 'TDVol_Viewer', TLB, EVENT_HANDLER='TDVol_Event', $
CLEANUP='TDVol_Cleanup', /NO_BLOCK
END
|