Atom Tree
An IDL object graphics factory as an alternative to iTools
What does the atom tree class do?
The atom tree class manages a set of IDL graphics objects. Normally, I would manage graphics objects with a suite of classes. That is, I would have a plot visualisation, an image visualisation and so on. If I wanted a plot, I would create a plot visualisation object to do the job.
For example:
tlb = widget_base() myPlot = obj_new('MyPlotVisualisation') myPlot -> build, tlb myPlot -> SetProperty, DATAX=indgen(10), DATAY=sqrt(indgen(10)) myPlot -> show
In contrast, the atom tree holds ALL IDL graphics objects. Each visualisation is created using a method call.
For example:
tlb = widget_base() myAtomTree = obj_new('nmtkatomtree',TLB=tlb) myAtomTree -> build myAtomTree -> addScene myAtomTree -> plot, 'myPlot', indgen(10), sqrt(indgen(10)) myAtomTree -> tv, 'myImage', dist(100) myAtomTree -> show
Why use the atom tree class?
There are several advantages of a single atom tree class
The atom tree class allows you to mix and match visualisations. For example, mixing a plot and image visualisation.
It is possible to extend the behaviour of the atom tree by adding a new method. There is no need to override the default behaviour of the class.
You can prototype a new visualisation just using the nmtkatomtree::addAtom method.
You do not need to maintain references to every graphics object. Graphics objects are contained in atom groups.
However, the atom tree is only useful for managing visualisations. It is not useful for event processing or data storage.
Where to use the atom tree class?
The atom tree class is ideal for use in conjunction with the following design patterns:
Singleton:
A singleton atom tree can be called from the command line. It is possible to write method wrappers so that atom tree methods can be called used just like tv, plot and oplot.
Global Identifier:
The atom tree inherits IDLitContainer. Each atom group is also contained inside a child IDLitContainer. This makes the graphics objects easily accessible using iTool identifiers.
Model, View, Controller:
The atom tree class soley handles the View aspect of the Model, View, Controller pattern. I have developed a suite of controllers each of which can be registered to a branch of the atom tree.