All Object Graphics applications require at least two basic building blocks. These include:
- A destination object - the device (such as a window, memory buffer, file, clipboard, or printer) to which the visualization is to be rendered.
- A view object - the viewport rectangle (within the destination) within which the rendering is to appear (as well as how data should be projected into that rectangle).
oWindow = OBJ_NEW('IDLgrWindow')
oView = OBJ_NEW('IDLgrView')
By themselves, a window and a single view are not particularly enlightening, but you will find that these two types of objects are utilized by all Object Graphics applications. To change an attribute of an object, you do not have to create a new instance of that object. Instead, use the SetProperty method on the original object to modify the value of the attribute.
For example, to change the color of the view to gray:
If more than one view is to be drawn to the destination, then an additional object is required:
- A scene object - a container of views
OScene = OBJ_NEW(’IDLgrScene’)
OView->SetProperty, LOCATION=[0.0,0.5], DIMENSIONS=[0.5,0.5], $
OView2 = OBJ_NEW(’IDLgrView’, LOCATION=[0.5,0.0], $
In the examples so far, the views have been empty canvases. For data visualization applications, these views will need some graphical content. To draw visual representations within the views, two additional types of objects are required:
- A model object - a transformation node
- A visualization graphic object - a graphical representation of data (such as an axis, plot line, or surface mesh). For more information, see Visualization Objects.
For example, to include a text label within a view:
oModel = OBJ_NEW('IDLgrModel')
oText = OBJ_NEW('IDLgrText','Hello World',ALIGNMENT=0.5)
Notice that the scene, views, model, and text are all combined together into a self-contained hierarchy. It is the overall hierarchy that is drawn to the destination object.
The transformation associated with the model can be modified to impact the text it contains. For example:
oModel->Rotate, [0,0,1], 90
When the objects are no longer required, they need to be destroyed. Destination objects must be destroyed separately, but the graphic hierarchies can be destroyed in full by destroying the root of the hierarchy. For example:
In this example, the destruction of the scene will cause the destruction of all of its children (including the views, model, and text).