Hello together,
When I create an object graphic, it takes a very long time.
I don't know, if there is something in my code, which could be optimized
or if it is just typical for object graphics [when some IDL people
showed the the itools, they were much faster ...], because im a rookie
in object graphics ...
Thanks for your help in advance !
Klemens
ok, here a part of my code:
oWindow = obj_new('IDLgrWindow',dimension=[1000,1000],renderer=1,$
retain=2,title='Surface Example')
;oWindow -> show, 0
oView = obj_new('IDLgrView',
viewplane_rect=[vx,vy,dx,dy],zclip=[30,-40],eye = 100, $
projection = 2, color=[255,255,255])
oModel = obj_new('IDLgrModel')
loadct, 0
; bounds of extinction coefficient classes
extco_classes = [0,100,200,300,400,500,600,700,800,900]
max_extco2 = max_ext_co - 0.1 * max_ext_co
d_extco2 = max_extco2 / 9.0
extco_classes = fltarr(10)
for i = 0, 9 do begin
extco_classes[i] = float(i) * d_extco2
endfor
;extco_classes = [0,10,20,30,40,50,60,70,80,90]
; colours of extinction classes
extco_colours = [246,232,218,204,190,176,162,148,134,120]
;xAxis = obj_new('IDLgrAXIS',0, range=[0.0,15],/exact)
xtitle = obj_new('IDLgrText','distance [km]')
xAxis = obj_new('IDLgrAXIS',0, range=[0.0,xco[nx]], tickvalues=xytval,
title= xtitle ,/exact)
xAxis->setProperty, major=3
oModel->add,xAxis
ytitle = obj_new('IDLgrText','distance [km]')
yAxis = obj_new('IDLgrAxis',1, range=[0.0,yco[ny]], tickvalues=xytval,
title=ytitle ,/exact)
yAxis->setProperty, major=3
oModel->add,yAxis
ztitle = obj_new('IDLgrText','height [km]')
zAxis = obj_new('IDLgrAxis',2,
zcoord_conv=[0,ueberhoehung],range=[0.0,zco[max_zindex_cloud ]+1],tickvalues=ztval,
$
title = ztitle,/exact)
;zAxis = obj_new('IDLgrAxis',2, range=[0.0,15],/exact)
oModel->add,zAxis
extco_classes0 = extco_classes
extco_classes1 = extco_classes0[1:*]
for i = 0, nx-1 do begin
print, i
for j = 0, ny -1 do begin
for k = min_zindex_cloud-1, max_zindex_cloud+1 do begin
if(cloudy[i,j,k] eq 255)then begin
; get colour data
l = where((ext_co[i,j,k] gt extco_classes0) and
(ext_co[i,j,k] le extco_classes1))
if(l lt 0) then l = 9
selco = extco_colours[l]
; get position data
dx = xco(i+1) - xco(i)
dy = yco(j+1) - yco(j)
dz = zco(k+1) - zco(k)
scale = [dx,dy,dz]
makeBlock,verts,connectivity,scale=scale,offset=[xco[i],yco[ j],zco[k]],ueberhoehung=ueberhoehung
oPoly = obj_new('IDLgrPolygon', verts, polygons=connectivity,
style=2, color = selcol)
;add the polygon to the model so that it will be displayed
oModel->add,oPoly
endif
endfor
endfor
endfor
;makeBlock,verts,connectivity,scale=[2,2,2],offset=[0,0,0],u eberhoehung=1
;oPoly = obj_new('IDLgrPolygon', verts, polygons=connectivity, style=2,
color =250)
;add the polygon to the model so that it will be displayed
;oModel->add,oPoly
; Light Model
oLight = obj_new('IDLgrLight',type=2, location = [-5,-5,125],
direction=[-1,-1,-1], color = [255,255,255])
oLightModel = obj_new('IDLgrModel')
oLightModel->add, oLight
oModel->rotate,[0,0,1],30
oModel->rotate,[1,0,0],-50
;add the model to the view
oView->add, oModel
oView->add, oLightModel
;draw the view to the window
oWindow->draw,oView
;
oWindow-> getProperty, image_data=image
write_tiff,
'e:\promotion\visualizations\'+strtrim(fieldname,2)+'_3d.tif f', image
|