A Simple Surface Object Example
This is an example of how to make and display a simple IDLgrSurface Object. The idea is to illustrate the most basic steps in putting up a surface object.
As you can see, you just need to
1. Create some data.
2. Create your model, your view, and your surface object.
3. Calculate normalized conversion factors.
4. Create a window to draw in.
5. Draw your surface into the window.
Example:
PRO mySurface
; create data
data = dist(100)
; create your model, your view, and your surface
oModel = obj_new('IDLgrModel')
oView = obj_new('IDLgrView')
oSurface = obj_new('IDLgrSurface', data, STYLE=1, $
COLOR = [0, 0, 255])
; Calculating normalized conversion factors and shifting
; -.5 in every direction.
; Keep in mind that your view default coordinate system
; is [-1,-1], [1, 1]
oSurface->GetProperty, XRANGE=xr, $
YRANGE=yr, ZRANGE=zr
xs = NORM_COORD(xr)
xs[0] = xs[0] - 0.5
ys = NORM_COORD(yr)
ys[0] = ys[0] - 0.5
zs = NORM_COORD(zr)
zs[0] = zs[0] - 0.5
oSurface->SetProperty, XCOORD_CONV=xs, $
YCOORD_CONV=ys, ZCOORD=zs
oModel->add, oSurface
oView->add, oModel
; rotate for better view of your surface
oModel->rotate, [1, 0, 0], -90
oModel->rotate, [0, 1, 0], 30
; create a window and draw the view of your Surface object
oWindow = obj_new('IDLgrWindow')
oWindow->Draw, oView
end